Before understanding JS prototypes, let’s first refer to classes in OOP. Classes are blueprints upon which we create objects. Everything in OOP languages are objects and every object is a instance of some class. Now comparing to OOP languages, JS is ...

Markdown supported · ⌘↵ to post
Victor Souza
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; // undefinedHowever, the prototype chain ends when null is found:
Object.prototype // nullThat 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 ✨🎉