0

Plz explain this

function ex(){ Return !!2; } Console.log(ex())

8th Nov 2018, 11:38 PM
Lailuma Norani
Lailuma Norani - avatar
2 Answers
+ 4
! Will convert the operand to boolean first, hthe rule is any object that is null, undefined,NaN, false, 0, -0, or empty string will be false else its true. In this cas is 2 so it'll be true !!2 -> !!true -> !false -> true
9th Nov 2018, 1:11 AM
Taste
Taste - avatar
0
thanks
9th Nov 2018, 10:30 PM
Lailuma Norani
Lailuma Norani - avatar