I'm trying to understand the following output:
'use strict';
console.log(Object.getPrototypeOf([]));
// []
console.log(Object.getPrototypeOf(Array.prototype));
// {}
console.log(Object.getPrototypeOf([]) == Array.prototype);
// true
console.log(Object.getPrototypeOf([]) === Array.prototype);
// true
console.log([]=={});
// false
console.log([]==={});
// false
In particular, why are lines 6 and 8 evaluated to be true
, whereas lines 10 and 12 are evaluated to be false
.#
Edit: I made a stupid typo on lines 6 and 8, which I have now edited. This makes the question different. Apologies.