JavaScript From The Start


Introduction to Prototypes in JS


Hide/Show description

JavaScript is a Prototype based language, not class based. With every object that you create there is also a Prototype object that you get which can hold properties that will be shared with all the objects that use the same prototype object. We can point one object at another to use as its prototype. There is a prototype chain that JavaScript will search for methods that match one that you are trying to use before it throws an error saying that the method doesn't exist. Code GIST: https://gist.github.com/prof3ssorSt3v3/e48b5c43a91a8a52b724f92fc8f314b5