JasonWyatt

This blog is full of stuff, and things.

Find my resume.

permalink

Did you know this? (RegExp)

Try doing something like this in a few browsers:

var myRegExp = new RegExp();
alert("typeof myRegExp = "+(typeof myRegExp);

This turns out to be a rare instance where Safari stands out from the crowd and gives a different answer from the others (IE 7, Firefox 3.5, Opera 10). I didn’t get a chance to test it on Chrome, but I’d be curious to know how it acts there and on other WebKit-based browsers - leave it in the comments if you can!

If you’re too lazy to try it on your own, here’s what happens: on Firefox, Opera, and IE 7 typeof someRegExpObject returns "object", however on Safari it returns "function". Weird!

blog comments powered by Disqus