3 ms·
First thing I did was paste this into an an editor, hit ctrl J, and see if jshint sprang up anything: 12,40: Expected an assignment or function call and
by nailer 12y ago
First thing I did was paste this into an an editor, hit ctrl J, and see if jshint sprang up anything:
12,40: Expected an assignment or function call and instead saw an expression.
Adding the missing + (and hence removing the expression which doesn't do anything) fixes it.
- nkozyra 12y agoIf everything is defined beforehand, jshint will show two warnings. The code is still valid. The OP is talking about catastrophic errors as a means for surfacing problems in code. That's a pretty old-school (and I don't mean to pick on the OP, he mentions his background in the post) methodology for quality control in code. It worked a lot of the time in compiled languages because they're far more syntactically strict than languages like Javascript. And that's why we need tools like jslint/jshint. Whether that's a good thing or not depends on your comfort with the language - having the flexibility to structure code differently can be seen as a positive, but you do open yourself up for these types of errors.