Truthy and falsy values in JavaScript #vscode

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Was curious about edge cases and it turns out there's a great one! `Document.all` is an object but when evaluated as a boolean it is falsey! This was due to a common practice for checking if a browser was IE (which used that nonstandard method and later, other browsers adopted it and it was kinda standardized).

bobthemagicmoose
Автор

No confusion at all. For instance "false" is definitely different from false.. 😅😅

thedelanyo
Автор

Summary: avoid if statements.

Apparently the can create confusion.

wtl
Автор

Yes I did know that JavaScript is terrible

orterves
join shbcf.ru