A Quick Explanation of Prototypical Inheritance in JavaScript

let P = Object.create(Square);
P.fill = 'red';
P.stroke = 'blue';
let D = Object.create(P);
let E = Object.create(P);
let F = Object.create(P);
D.fill = 'green';
F.stroke = 'magenta';
F.fill === 'red';
>>True

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

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