+ 3

Did you know this?

var foo = [0]; console.log(foo == !foo); // true console.log(foo == foo); // also true!!!

2nd Jan 2021, 4:25 AM
Tomás CL 🇨🇺 (temporarily inactive)
Tomás CL 🇨🇺 (temporarily inactive) - avatar
1 Odpowiedź
+ 2
!foo = false 0 => false as binary That's why foo ==!foo is true. If you do this with foo= [1 or 2 or....] it will return false.
2nd Jan 2021, 4:44 AM
Divya Mohan
Divya Mohan - avatar