4 ms·
No, otherwise I would have written it that way. ;)
by gbuk2013 7y ago
No, otherwise I would have written it that way. ;)
- foobarbecue 7y agoWell, then I strongly disagree. Modern JS is very easy to write, but extremely complex because of all the leftover cruft. For example, a beginner can declare a varible with let, const, var or (what could be easier) nothing at all. The resulting scoping rules, however, are anything but simple.
- gbuk2013 7y agoI don't think it's complex at all. The scoping rules are very simple. Block scoping just added another piece. The difficulty is that there are many simple things like this to learn and to combine in a safe and maintainable manner for anything other than trivial programs. Out of the box, the language does nothing to discourage bad coding practices (some might say it even encourages them). It's the flip-side of being such an accessible language. It is possible write JS in a way that avoids a lot of the complexity, but it requires experience and discipline and some tooling, just to be sure. The code will look simple but it is not an easy thing to do.
- foobarbecue 7y agoProgramming is mostly the practice of reading code rather than writing, and this is where the complexity is felt.