0
WHY? (not a quiz)
function isFalse() { return false; } console.log(!!isFalse); I'm sorry for not being more clear, it's not a quiz. It's something I don't understand! I don't wanna call the function, I just don't understand why is it true? But if you try "isFalse === true", guess what => false :))
6 Answers
+ 6
!! is a way of getting the boolean value of an expression.
!!isFalse is true because you are not calling the function and your are getting the boolean value of the function object called "isFalse".
Answer true.
Radu Harangus isFalse === true is false because you are comparing a function and a boolean value. === doesn't allow type coercion so it returns false for 2 different types. !!isFalse === true because you are coercing isFalse to a boolean value(true).
+ 3
Is this something you don't understand or you want to quiz us?
If it's a quiz, please post in your personal feed instead.
For what, please test in code playground
Show me your answer to what, and I'll answer you why
0
What do you want?
0
I'm not sure what your show is about.
0
Yes
0
you need change
console.log(!!isFalse)
for
console.log(!!isFalse())