JavaScript Best Practices
Getting things done is good but getting things done in better way is what matters most. Everyone wants to make their website/application to be faster, lighter. No one likes slow website/application. In order to make website/application we have to set some best practices standards and every teammate should follow that. I have written down few of the best practices which I recommend to be followed in any JavaScript development. Use === Instead of == Eval = Evil Don't use short-hand Bad Recommended if(condition) x = false; if(condition){ x = false; } Place scripts at the bottom of your page. The fastest way to build a HTML list. var arr = ['item 1', 'item 2', 'item 3', ...]; var list = '<ul><li>'+arr.join('</li><li>')+'</li></ul>'; Reduce global variables and methods. Add comme...