match() in JavaScript

<script language="JavaScript1.2">
    <!--
    var myString = new String("This is Mr. Right");

    var myRegExp = /\s\w*/g;

    var answerArray = myString.match(myRegExp);

    if(answerArray == null){
      document.write('No matches were found');
    }else{
      document.write('The following matches were found: <br>');
      for(var i = 0; i < answerArray.length; i++){
        document.write(answerArray[i] + '<br>');
      }
    }
    document.close();
    -->
    </script>