19+ JavaScript Shorthand Coding Techniques
1. The Ternary Operator
This is a great code saver when you want to write an if..else statement in just one line.
Longhand:
const x = 20;
let answer;
if (x > 10) {
answer =…