Passionate with code... In love with Web Design, Videogames, Books and Jazz music.Years of experience in "document composition" and a Front-End Developer wannabe (since years)
Now, in people's defense, JavaScript's syntax is terrible, it's absurd that this works (when it would be so much more useful to have toplevel objects), and given that it works, it's absurd that you can't drop the braces around function bodies.
I know what you're talking about.
But do we know, why It's still working?
It's working because of blocks.
You're creating blocks, inside blocks... inside blocks.
That's important in JS, because of the lexical-scope.
I'm not saying that's ok ... I'm just saying that in JS It works like that, not just because It's bad
I know what you're talking about.
But do we know, why It's still working?
It's working because of blocks.
You're creating blocks, inside blocks... inside blocks.
That's important in JS, because of the lexical-scope.
I'm not saying that's ok ... I'm just saying that in JS It works like that, not just because It's bad
Apparently I didn't use the word
block
in there, but yes, I understand this :)If you want to be really irritated with JS, figure out what's going on with these examples (hint)