Software Style Guide ==================== .. note:: Converse.js doesn't yet use any of the new `ES2015 `_ features, because we don't rely on a transpiler and still support older browsers. Most of the style guide recommendations here come from Douglas Crockford's book "Javascript, the good parts". This style guide is fairly opinionated. Some of these opinions perhaps don't conform to your expectations on how Javascript code should look like. I apologize for that. However, for the sake of sanity, consistency and having code that is pleasing to the eye, please stick to these guidelines. Tabs or spaces? --------------- We always indent 4 spaces. Proper indentation is very important for readability. Underscores or camelCase? ------------------------- We use camelCase for function names and underscores for variables names. For example: .. code-block:: javascript function thisIsAFunction () { var this_is_a_variable; ... } Spaces around operators ----------------------- In general, spaces are put around operators, such as the equals ``=`` or plus ``+`` signs. For example: .. code-block:: javascript if (sublocale != locale) { // do something } An exception is when they appear inside for-loop expressions, for example: .. code-block:: javascript for (i=0; i