+ 1
(1)What's the meaning of the condition(bool?) in console?...... (2)pls explain the commented line?
let arr=[5,NaN,6]; let bool=arr.includes(NaN);/*.....explanation pls.....*/ console.log(bool? true :false);
2 Respuestas
+ 2
let arr=[5,NaN,6];
let bool=arr.includes(NaN);
//this means checking that the array arr is includes or having value NaN ? Yes so it returns true.....
(condition)?(exp1) : exp2
//=> is a ternary operator , if condition is true then exp1 is evalueted else the exp2 is evaluated. it is alternative , short way of
//if(condition) exp1 else exp2
console.log(bool? true :false);
+ 1
Jayakrishna🇮🇳 thanks