[Solved] Proper JavaScript code [closed]


Since JavaScript is a C-style language (syntactically derived from Java), all the known coding styles from those worlds are possible. Choose one yourself.

If you’re working on a project with other people, you should agree on some coding conventions.

Common and influential ones (from larger projects) are:

See also JavaScript Style Guides And Beautifiers by Addy Osmani.


I prefer this: function sample(arg1, arg2) {

That’s indeed the most common style.

solved Proper JavaScript code [closed]