Type coercion in JavaScript

preview_player
Показать описание
#javascript #coding #shorts
Рекомендации по теме
Комментарии
Автор

Here comes the explanation:

It involves implicit coercion between the array ([]) and boolean ![].

In JavaScript, ![] is coerced to false, and [] is coerced to an empty string.

Then the comparison becomes
'' == false,
which coerces false to 0 and '' to 0, so the result is true.

bytecode-dev
welcome to shbcf.ru