JavaScript prototype chain | Simple

  • by

In JavaScript, every object has a prototype, including the prototype object. This “chain” goes all the way back until it reaches an object that has no prototype, usually Object‘s a prototype. Because each object has a private property that holds a link to another object that’s why it is called a prototype chain in JavaScript.

function Dog(name) { = name;

The prototype is basically a property of a JavaScript function. The prototype’s version of “Inheritance” involves adding another link to the end of this prototype chain, as shown above.

JavaScript prototype chain

Simple example code.

<!DOCTYPE html>
    const myObject = {
      city: 'Madrid',
      greet() {
        console.log(`Greetings from ${}`);



JavaScript prototype chain

Read more:

Do comment if you have any doubt or suggestions on this Js prototype topic.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.