+ 1
let height = 40 let isCheck = true let rowHeight = height + (isCheck ? 50 : 20)
why would the answer be 90?
2 Respuestas
+ 3
That is ternary Operator or conditional Operator you can say.
If the condition provided is true than first part is executed otherwise second
Your code is equivalent to :
if (isCheck){
rowHeight = height + 50;
} else {
rowHeight = height + 50;
}
0
let height = 40
let isCheck = true
let rowHeight = height + (isCheck ? 50 : 20)