1const condition = true;
2// (condition) ? if : else
3(condition) ? console.log("it is true") : console.log("it is false");
1var time = Date().getHours(); // or something
2
3var clockTime = time > 12 ? 'PM' : 'AM' ;
4
1(lemons) ? alert("please give me a lemonade") : alert("then give me a beer");
1// If statement
2// if (condition) //code
3if (5 > 3) return "Is greater"; // "Is greater"
4
5// If else statement
6// (condition) ? if : else
7let res = (1 > 3) ? "is greater" : "is less than";// "is less than"
1var res = 1 == 1 ? 'true' : 'false' // res = true
2var res = 1 == 2 ? 'true' : 'false' // res = false