Are there any coding standards for JavaScript? [closed]

Solution 1:

Not exactly what you're looking for, but (like Doug Crockford's vids) I think everybody who writes/edits/reviews JS should look at Chris Heilmann's slides and videos on maintainable javascript.

In the slides, slide 127, he says don't worry so much about style guides/code standards, reformat all code checked in to VCS.

Also these:

Mozilla JavaScript Tips

JavaScript Style Guide

Solution 2:

Another reason why Crockford's JavaScript coding guidelines are a good idea to follow:

This code (below) actually returns undefined because of JavaScript's semicolon injection - which is a damn good reason to get the whole team of developers singing from the same song sheet:

return // injected semicolon, therefore returns 'undefined'
{
    javascript : "fantastic"
}; // object constructs anonymously but nothing happens with it.

Bit more about that at Beware of JavaScript semicolon insertion