3 ms·
That may not be a particularly interesting example, but I don't think it's bad. var a = 5; var a = function() { alert('hello world'); }; var a = 2;
by ericwaller 18y ago
That may not be a particularly interesting example, but I don't think it's bad.
var a = 5;
var a = function() {
alert('hello world');
};
var a = 2;
It's not a closure (which is what I assume you were hoping for), but it definitely reveals something pretty unexpected about the language for someone who has no experience with first class functions.
- bradgessler 18y agoYeah, that's also pretty bad. It doesn't show what you can do with the function.