If you call a property/method and it doesn't exist, it returns undefined:
const myObject = {
city: "Madrid",
greet: function () {
console.log(`Greetings from ${this.city}`);
}
}
myObject.greet(); // Ok: Greetings from Madrid
myObject.country; // undefined
However, the prototype chain ends when null is found:
Object.prototype // null
That is a little weird for me, but I got it :)
Adib Hasib, thanks for the great post. I was studying it today so its nice to read it here ✨🎉