Re:Oddities about JavaScript
by stanleydrew on Monday May 30, 2011 @12:04PM
(#2599707)
Section 7 is so completely wrong:
This won't do what he thinks it's going to do. Instead of alerting 'hello' after 1 second (after the value has been changed to 'goodbye') it alerts 'hello' immediately and does nothing after 1 second. Perhaps he meant something like:
This should alert 'hello' after 1 second even though someVar has by then been overwritten.
[ Parent
| on HN ]
@stanleydrew - I changed this code late last night after I realised my mistake here. Of course I had meant to return a function from the SEF, which the code in the article now does. Apologies for the oversight.
((EDIT: was irrelevant, as pointed out by stanleydrew in the post below. Thanks!))
Re:Oddities about JavaScript
by stanleydrew on Monday May 30, 2011 @12:44PM
(#2599799)
That's the example of what doesn't work from the beginning of section 7. That will alert 'goodbye' after one second. I'm calling out his "fixed" code, which is supposed to alert 'hello' after one second.