how to ask a question in ternary operator in javascript code example
Example 1: ternary function javascript
var variable;
if (condition)
variable = "something";
else
variable = "something else";
//is the same as:
var variable = condition ? "something" : "something else";
Example 2: javascript question mark
//This is what is called a 'Conditional operator'
let result = condition ? value1 : value2
// ^^ ^^ ^^
let result = 1 == 2 ? "YES" : "NO!"
console.log(result) //output: "NO!"
//Basically a short form of an if-else statment