Recommended Reading for Polishing JavaScript coding style?

Posted by wml653 on Programmers See other posts from Programmers or by wml653
Published on 2011-02-04T19:11:14Z Indexed on 2011/02/04 23:34 UTC
Read the original article Hit count: 276

Filed under:
|

I've been coding in JavaScript for a while now and am fairly familiar with some of the more advanced coding features of the language (closures, self-executing functions, etc). So my question is, what advanced books/blogs/or anything else would be recommended to help tighten up my coding style?

For example, recently I was coding something similar to:

var x = ['a', 'b', 'c'];
var exists = false;
for(var i = 0; i < x.length; i++){
    exists = x[i] === 'b' ? true : exists;
}

But found that the following condensed code would work better:

var y = {'a':'', 'b':'', 'c':''};
var exists = 'b' in y;

Both store the same value in 'exists', but the second is less common, but much cleaner. Any suggestions for where I should go to learn more tricks like this?

© Programmers or respective owner

Related posts about JavaScript

Related posts about ecmascript