1const x = true;
2var result = x === true ? "passed" : "failed";
3
4//Explanation
5//var 1.result = 2.x 3.=== 4.true 5.? 6."passed" 7.: 8."failed";
6//1.result
7//2.left side of if statement
8//3.if statement operator
9//4.right side of if statement
10//5.shorthand then operator
11//6.if true the result will be "passed"
12//7.shorthand else operator
13//8.if false the result will be "failed"
1let let x: number = 10, y = 20;
2
3if (x > y)
4{
5 console.log('x is greater than y.');
6}
7else
8{
9 console.log('x is less than or equal to y.'); //This will be executed
10}
11