when var patt is cretaed as shown above, how does it create an object of RegExp type ? To create an object of a particular type, its required to be created as "var patt=new RegExp(pattern,modifiers);" If we just specify "var patt=/Hello/g;" how will script understand that its of RegExp type only and nothing else ?
var str="Hello world!";
//look for "Hello"
document.write("Returned value: " + result);