• Friday , 20 October 2017

Prototype basics – Object Creation in JavaScript P3 – FunFunFunction #46

Code Canyon



We’ll go through the absolute basics of the prototype in this video. I’m going to explain why you should learn prototypes, and how they work.

Complete series playlist: “Object creation in JavaScript”
https://goo.gl/ELUE4B

You’re probably used to doing inheritance with classes. JavaScript achieves inheritance using prototypes. The real-world analogy used when teaching classes is a blueprint – you have a blueprint of a building, and you use that blueprint to build buildings. The real-world analogy to a prototype is a delegate, a person that has been elected into office that will act on your behalf.

This video is for you if you are coming from another programming language into JavaScript and you’re already somewhat familiar with object oriented programming. You know what classes and inheritance is, but you’re confused about how object orientation is done in JavaScript.

I’m also active on:
• Twitter https://twitter.com/mpjme
• Medium https://medium.com/@mpjme
• Quora https://www.quora.com/profile/Mattias-Petter-Johansson

Original source

3d Ocean

Related Posts

21 Comments

  1. QuasiBiscuit857
    September 7, 2017 at 08:06

    VIEWS
    47,130
    TIME WATCHED
    261 days
    SUBSCRIPTIONS DRIVEN
    307
    SHARES
    155

  2. Daniel Breen
    September 7, 2017 at 08:06

    I need a little clarification on what is a prototype of what. I think that dog, cat, and prairiedog should all be prototypes of animal, but it's always stated that animal is a prototype of the other three. It's the equivalent of someone telling me that eggs lay chickens. I'm sure you're correct, I'm just missing something.

  3. Dora Bah
    September 7, 2017 at 08:06

    crap

  4. adamgm84
    September 7, 2017 at 08:06

    not sure if you do already but you would make a hell of a lot more money if you sell tshirts and swag to your network of followers 🙂

  5. Zerk
    September 7, 2017 at 08:06

    Now this is how u explain prototype chain. Good stuff.

    It would be even better if u made an empty object wildDog = {}, then Object.setPrototypeOf(wildDog, dog) and then called wildDog.talk() that would be the 'full' proto chain example cause it would call talk up from animal and sound from dog.

  6. Souma Mondal
    September 7, 2017 at 08:06

    YEH LIKE DAGS?

    but srsly, great video.

  7. new born
    September 7, 2017 at 08:06

    For those who are already convinced about learning Prototype basics , go to 4:51 . You are welcome 🙂

  8. Gemaskerde Sopbeen
    September 7, 2017 at 08:06

    I think it would have been a nice illustration if you also added
    prarieDog.talk()
    at the end of the exercise.

    Thanks for these videos, I really enjoy them.

  9. Perfect Makanju
    September 7, 2017 at 08:06

    I loved the part where you said… why don't you marry prototypes. :). Please mpj, i would like to know which softwares you use for your web series. I would like to start a video series soon and I'm looking for some tips.

  10. Lakhveer Singh
    September 7, 2017 at 08:06

    more talk less info

  11. Pedro Serapio
    September 7, 2017 at 08:06

    This a mind bending explanation, "…don't try bend the spoon, instead, think, there is no spoon!"

  12. Damain Joseph
    September 7, 2017 at 08:06

    So what I understand is that prototype is like a asking a project manager to do something that he can't do himself and he says ok, then passes it on to the person that has that skill in his team to get the work done.

  13. Marcelo Lima
    September 7, 2017 at 08:06

    9:01

  14. Anders Rapp
    September 7, 2017 at 08:06

    I suppose that before you set the cat to have the prototype of animal it already had a prototype which was the global erhm…prototype? And as you pointed out a few seconds before the global prototype doesn't have a talk function. So if you then call the cat.poop() function neither the cat, the animal nor the global prototype will have it. Correct?

  15. Agorafobico
    September 7, 2017 at 08:06

    5:07 Could? Should? Nice

  16. Kaan KÜÇÜK
    September 7, 2017 at 08:06

    man! your plant is dying.

  17. plushoom
    September 7, 2017 at 08:06

    cool, very clear and easy: similar to JAVA

  18. lama
    September 7, 2017 at 08:06

    ultimately, I watch it because of the JS – not you as a entertainer. So some balance and more effort at explanations, please…

  19. lama
    September 7, 2017 at 08:06

    ok, you are fun- but I want MORE JS explanations… more thorough and more clear how / what works!

  20. First LastCreativity
    September 7, 2017 at 08:06

    The analogy of the Delegate has really helped cement in my mind, what the prototype really is. Thank you.

Leave A Comment

You must be logged in to post a comment.