if condition in one line typescript code example
Example 1: js inline if
var a = 2;
var b = 3;
var c = ((a < b) ? 'minor' : 'major');
Example 2: if shorthand typescript
const answer = x > 10 ? "greater than 10" : "less than 10";
var a = 2;
var b = 3;
var c = ((a < b) ? 'minor' : 'major');
const answer = x > 10 ? "greater than 10" : "less than 10";