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:

see javascript style guides , beautifiers addy osmani.


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

that's indeed common style.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -