If you only hate Javascript sometimes, you are definitely new to the language. That said even in a proper language like Ruby this particular bug can happen, that's why communities around these languages strongly encourage proper discipline, enforced by tools. This bug most definitely should've made your tests go red, your linter give a warning and your code metrics suite should have a thing or two to about the huge e…
Why I sometimes hate JavaScript
11–20 of 66 posts
Re: Why I sometimes hate JavaScript
#12If you only hate Javascript sometimes, you are definitely new to the language. That said even in a proper language like Ruby this particular bug can happen, that's why communities around these languages strongly encourage proper discipline, enforced by tools. This bug most definitely should've made your tests go red, your linter give a warning and your code metrics suite should have a thing or two to about the huge e…
Is a function longer than 10 lines considered a problem by JavaScript analysis tools (or their users)? Surely you jest?
If your function is over 10 lines, it's probably bad, just look at your functions. Every 10+ line function I've ever written was only that long because of laziness and reducing them has always resulted in better legibility.
Re: Why I sometimes hate JavaScript
#13Re: Why I sometimes hate JavaScript
#14There are tools to make up for these language deficiencies, but our attitude to those bitten by the language deficiencies it's truly unfortunate.
Even Python, everyone's second favorite dead horse for dynamically typed language problems, would throw an error here.
Re: Why I sometimes hate JavaScript
#15If you only hate Javascript sometimes, you are definitely new to the language. That said even in a proper language like Ruby this particular bug can happen, that's why communities around these languages strongly encourage proper discipline, enforced by tools. This bug most definitely should've made your tests go red, your linter give a warning and your code metrics suite should have a thing or two to about the huge e…
Is a function longer than 10 lines considered a problem by JavaScript analysis tools (or their users)? Surely you jest?
Re: Why I sometimes hate JavaScript
#16In another language the compiler/parser may have thrown a warning, but the issue here is actually that this is valid Javascript. Poorly composed Javascript, but completely valid.
Of course, jslint will complain about it (and a dozen other style things), so the more people utilize tools like that, the better.
More than anything, it's yet another reason to employ unit testing. Valid code that fails is very hard to debug without unit testing.
Re: Why I sometimes hate JavaScript
#17What Node.js taught me is that JavaScript is language like any other. It has good parts, it has quirks and you have to know what are its strenghts and what are its weaknesses to use it properly. And you can say that about any other language.
Does what you just said mean that we shouldn't talk about JS's weaknesses?
Or do you mean that we can, but that the points the author brings up have been beaten to death time and time again here on HN and this post + the inevitable comments it will attract have nothing to offer?
Those are the only two options I can think of for now. Or did you mean something else?
Re: Why I sometimes hate JavaScript
#18What Node.js taught me is that JavaScript is language like any other. It has good parts, it has quirks and you have to know what are its strenghts and what are its weaknesses to use it properly. And you can say that about any other language.
Ehm, yes. Sorry to ask this, but what is your point? I don't understand why you are saying this thing, which nobody here would disagree with. Does what you just said mean that we shouldn't talk about JS's weaknesses? Or do you mean that we can, but that the points the author brings up have been beaten to death time and time again here on HN and this post + the inevitable comments it will attract have nothing to offer…
There are many totally lucid, on-point criticisms of Javascript and at least once a day the language ticks me off, but this one is not so black-and-white.
Re: Why I sometimes hate JavaScript
#19The real issue here is it's not an error. In another language the compiler/parser may have thrown a warning, but the issue here is actually that this is valid Javascript. Poorly composed Javascript, but completely valid. Of course, jslint will complain about it (and a dozen other style things), so the more people utilize tools like that, the better. More than anything, it's yet another reason to employ unit testing.…
Re: Why I sometimes hate JavaScript
#20What is actually being done with the calls after the chain of +'s?
Edit: Something to do with semicolons being optional in js?