Did you know this? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Resposta
+ 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