Use a functional programming style where possible, in practice this means:
for-in or for-of (they are also faster)Use === and !== over == and ! =
Use Semicolons!
Use const for all of your references; if you must reassign references, use let.
Never use var.
Bad
var a = 1;
var b = 2;
let a = 1;
let b = 2;
Good
const a = 1;
const b = 2;
let count = 1;
if (true) {
count += 1;
}
Use the literal syntax for object creation.
Bad
const item = new Object();
Good