JavaScript Prototypes

Introduction to JavaScript prototypes and their uses.

Background

We know about JavaScript objects and their mutation. We have assigned properties from one object to another. The question still remains. Is there a neater way of having all properties of another object?

Introduction to prototypes

All JavaScript objects have the property prototype. They go under the property name __proto__. The prototype of each object is assigned during creation and is itself an object. Look at the following code.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy