1const condition = true;
2// (condition) ? if : else
3(condition) ? console.log("it is true") : console.log("it is false");
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
1/* When width is <= 600 breakpoint is 1, when width is between 600 and 1000 breakpoint is 2, else is 4 */
2let breakpoint = width <= 600 ? 1 : width <= 1000 && width > 600 ? 2 : 4; // Breakpoint observer code