Objects and prototypes in JavaScript

Factory Pattern

Factory pattern

Constructor Pattern

Constructor pattern

Prototype Pattern

Prototype pattern
personProto prototype details

Dynamic Prototype pattern

Dynamic prototype pattern

Using Object.create() method

With ECMA5, a new method was introduced for creation of Objects, i.e. Object.create(). Calling this method creates an object, and prototype of this object is the first argument of ‘create. function.

Object.create()

Inheritance in JavaScript

Till now, we what ‘prototype’ of an object means in JavaScript. In this topic, we will cover prototype-based inheritance in JavaScript.

Prototype chain
function expression and prototype chain
Object hierarchy

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store