Recommended Reading for Polishing JavaScript coding style?
- by wml653
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?