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
Зареєструйся Зараз
або Підпишись на майбутні тести