Best Practices


Always use double quotes for strings

You can use single or double quotes, but double quotes are recommended.

let string1 = "some ' text";   
let string2 = 'some " text';

Always use the triple equals ===

if ('100' === 100) {   // false  
if ('100' == 100) { // true

Always use the exclamation and double equals !==

?? 

All function names should be in lowercase


All source file names should be in lowercase




Never have lines break within a statement


Never start a newline with an opening curly parenthesis


Never start a newline with an opening square parenthesis


Do not use anonymous functions


Do not use Anonymous Function Expressions

There is no way to refer to itself from inside the function (so recursion is not possible)
They are much harder to debug
They make your code harder to read


When to return and when not to return




© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext