DEV Community

Discussion on: Here are Top 5 Best Practices for JavaScript you MUST ALWAYS FOLLOW

Collapse
 
blindfish3 profile image
Ben Calder

The point is to understand where automatic semicolon insertion is going to cause bugs and avoid code that will allow it (preferably with lint rules) and then be consistent. The classic example is to avoid a return statement that splits the returned value to a new line.

Anyway I'll add a sixth best practice you should always follow:

Never follow advice that says you should always follow it. There are always exceptions :)