Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

ternary operator typescript

//condition ? expressionIfTrue : expressionIfFalse

let balance = 20;
balance > 20? "rich" : "broke";

//It is equivalent to if(balance > 20){"rich"} else{"broke"}
 
PREVIOUS NEXT
Tagged: #ternary #operator #typescript
ADD COMMENT
Topic
Name
8+7 =