Try these in your browser's JS console:
{}['constructor'] //==> ['constructor']
{}['constructor'] === ['constructor'] //==> false
console.log({}['constructor']) //==> function Object() { [native code] }
The first expression evaluated returns an array with a single item: 'constructor', However, the second expression seems to contradict the first by returning false. The third logs the Object constructor to the console.
Why are the second two expressions not consistent with the first?
[1] === [1]to see why the second one is false. Each array literal is a different array.constructorproperty...{}['constructor']will be evaluated as an expression (which is what the third example shows). And obviously the constructor won't be equal to an array