Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Like the scope chain, the prototype chain will use the first value it
finds during the chain lookup.
Modifying the last code example, if we added the same value to the
Object.prototype and Array.prototype objects, and then attempted to
access a value on an array instance, the value returned would be from the
Array.prototype object.
<!DOCTYPE html><html lang="en"><body><script> Object.prototype.foo = 'object-foo'; Array.prototype.foo = 'array-foo'; var myArray = []; console.log(myArray.foo); // logs 'array-foo', was found at Array.prototype.foo myArray.foo = 'bar'; console.log(myArray.foo) // logs 'bar', was found at Array.foo </script></body></html>