it always good to have some standardized coding rules
use jshint, JSHint and .etc to create auto checker based on these rules
indentation 2 spaces
indentation type tab
- refer to usejsdoc
- put
'use strict';on top. - use single qoute for string.
- function brackets put as the sample below.
- no restrict on having space after
= - use flow to check javascript input type, (more details).
/** * @flow * @param {Object} arg1 - user credentials. * @param {boolean} arg2 - login for 1 month. * @return boolean */functiontest(arg1,arg2){varstring='test string';// sample of string definationvarusername=arg1.username,password=arg1.password;varlogin=that.login(username,password,function(data){returndata.result;});returnlogin;}- no
"..." + "..."allowed in code when writing sql statement