Proper JavaScript code -
what proper way write javascript functions/indent code:
this:
function sample() { } or this:
function sample() { } also, spaces, this:
( arg1, arg2 ) or this:
(arg1, arg2) what this:
() { or this:
(){ this prefer:
function sample(x1, x2) { }
since javascript c-style language (syntactically derived java), all known coding styles worlds possible. choose 1 yourself.
if you're working on project other people, should agree on coding conventions.
common , influential ones (from larger projects) are:
- node.js style guide
- crockford's code conventions
- google javascript style guide
- mozilla coding style (language-agnostic)
see javascript style guides , beautifiers addy osmani.
i prefer this:
function sample(arg1, arg2) {
that's indeed common style.
Comments
Post a Comment