Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

But this is a simple error caught by js(h/l)int. And it's especially easy to spot if you just declare each var one after another:

    var a,
        b,
        c,
        d;
        e;
         
Then your editor (which you've a integrated a linter... right?) will protested:

    yourJsFile.js |5 warning| 'e' was used before it was defined.
And if you have a global by the same name you'll see:

    yourJsFile.js |5 warning| Expected an assignment or function call and instead saw an expression.
Granted, if you assign it a default value then, yes you're going to have a bad time. But if you follow the white spacing rules of jsLint it will catch the obvious error.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: