1) The Ternary Operator
Longhand-
const x = 20;
let answer;
if (x > 10) {
answer = "greater than 10";
} else {
answer = "less than 10";
}
Shorthand
const answer = x > 10 ? "greater than 10" : "less than 10";
2) Declaring Variables Shorthand
Longhand-
let x;
let y;
let z = 3;
Shorthand
let x, y, z=3;
3) If True Presence Shorthand
Longhand-
if (likeJavaScript === true)
Shorthand
if (likeJavaScript)
4) If Not True Presence Shorthand
Longhand-
if (!likeJavaScript === true)
Shorthand
if (!likeJavaScript)
5) Arrow Function Shorthand
Longhand-
function doAnything(){}
Shorthand
let doAnything = () => {}