Javascript ++: How to Level Up Your Code

Try to Avoid Type Constructors

let x1 = new Object();
let x2 = new String();
let x3 = new Number();
let a1 = {};
let a2 = "";
let a3 = 0;

Use Strict Equals

"42" == 42
=> true
"42" === 42
=> false

Lots of Variables

function sayHello(options) {
let sentence = {
greeting: "Good morning!",
pleasantry: "How are you,",
name: "buddy",
exclamation: "?",
question: "some coffee?"
}
}
let name = "John"
let exclamation = "!?"
let question = "lunch?
function sayHello(, , name, question, exclamation)
=> "Good morning! How are you, John!? Do you want to grab lunch?"

Thoroughly Comment Your Code

//This code will greet a user upon loginfunction greeting() {
alert("Welcome!")
}

Passing Empty Parameters

method(...['parameter1', , 'parameter3'])

Bonus:

Full-Stack Engineer, UX/UI Aficionado, and lover of coffee.

Full-Stack Engineer, UX/UI Aficionado, and lover of coffee.