What will be the result of following code?

var a = [];
console.log((a == a) + ' ' + (a == !a));
Explanation
(a == a) - we compare link to itself and result is true. (a == !a) - second operand "!a" converted to the boolean and thus generates conversion to boolean "a". [] == false // empty array == false ![] == false // link to array object with ! operator == false that is means [] == ![] // true

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты