&& in ternary operator javascript code example
Example 1: ternary function javascript
var variable;
if (condition)
variable = "something";
else
variable = "something else";
var variable = condition ? "something" : "something else";
Example 2: ternary operator shorthand javascript
let startingNum = startingNum ? otherNum : 1
let startingNum = otherNum || 1
let startingNum = startingNum ? otherNum : 0
let startingNum = startingNum && otherNum
Example 3: ternary operator js
condition ? expression1 : expression2