When trying to do this:
setTimeout(function(){alert("Boo");}, 500);
I accidentally wrote this:
setTimeout(new function(){alert("Boo");}, 500);
The former version waits 500 millis, then alerts. The latter alerts immediately.
Why does adding new in front of the function cause this behavior?
Using
newcreates a new object using the anonymous function as its constructor, so your function runs and alerts immediately.