Sometimes running JS directly within the global scope may introduce more unexpected results.
Based one on the very interesting JavaScript Blog of my friend 周愛民 Chou Aiming, a well-known and solid JavaScript developer, I'd like to share his latest study about a failed optimization work with the JavaScript engine, Spider Monkey.
Let's test the script below for modern browsers, note that this test is running in global scope.
print » foo
print » bar
print » wow
print » false
print » false
Looks very simple, while Firefox has different opinions...
print » wow
print » wow
print » wow
print » true
print » true
You may test the same script for yoursels, just make sure that you're running this directly in your web pages instead of the Firebug console
or another possible hacky fix for SpiderMonkey..
Whew!
Hedger Wang