It’s a beginner-focused explanation, but that’s just my writing style, in no way i’m trying to be condescending. :-)

(Versión en español en breve!)

Let’s dig a bit on protoype and inheritance in JS!

First we create a “Dog” function.

And we add a “Bark” function to our recently created “Dog” function

Now we are going to create “bailey”, our lovely dog friend.

BTW: Got the name from here http://dogtime.com/top-100-dog-names

We’ve only known each other for 8 lines of code, but i already like Bailey, it’s awesome.

Now, let’s make Bailey bark.
Copy and paste the code up there (dog3.js) …

About

Felipe Andrés Torres Sepu

JS Engineer by choice, Educator at heart. I co-run @javascriptChile and @Noders — Make Development Great Again

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