I'm going through the book JavaScript: The Definitive Guide 7th edition.
And in objects section I encountered a strange phrase that
Remember: almost all objects have a prototype, but only a relatively small number of objects have a prototype property. It is these objects with prototype properties that define the prototypes for all the other objects.
What I find confusing is that it says first, almost every object has a prototype and then says only a relatively small number of objects have a prototype property. I find these as two contradicting statements; how come almost every object has a prototype while everyone of them doesn't get to have prototype property.
Can you explain what above statement means?
May be this can enlight you: (the sentence is not well formulated, almost all objects have a prototype chain inheritance, but only a relatively small number of objects defines a prototype property
)
function Foo() { }
Foo.prototype.bar = function () {// prototype property on Foo
console.log('bar');
};
const foo = new Foo();
console.log(foo.__proto__);// object
const baz = Object.create(null);
console.log(baz.__proto__);// undefined