JavaScript Question: When Should I use the Prototype?

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 13

  • @BlaBlaBlaInDaHouse
    @BlaBlaBlaInDaHouse Год назад

    Great video once again! Thank you for your time

  • @tajpouria
    @tajpouria 5 лет назад +2

    Hi, how you become master in javascript various concepts sir?

    • @AllThingsJavaScript
      @AllThingsJavaScript  5 лет назад +10

      These are the steps I would suggest. Take time to learn it. I feel a course or a book is important so you aren't just learning parts. Then work on projects. Challenge yourself. Finally, always continue learning. Never stop learning new things about JavaScript all through this process.

    • @2004helloWorld
      @2004helloWorld 4 года назад +1

      @@AllThingsJavaScript is there a book(s) you recommend?

    • @AllThingsJavaScript
      @AllThingsJavaScript  4 года назад +3

      @@2004helloWorld My favorite books can be seen at the bottom of my site: allthingsjavascript.com

  • @ziat1988
    @ziat1988 4 года назад

    I don't see you explain why this reduce memory

    • @AllThingsJavaScript
      @AllThingsJavaScript  4 года назад

      Not sure I understand the question.

    • @wahoobeans
      @wahoobeans 4 года назад +1

      If you create many objects from a function constructor, each instance will designate memory for the attributes and methods. Instead of recreating the same method for every instance, all instances can find the method by looking at the prototype object. All instances share the same __proto__. Thus, this reduces the space for methods from n number of instances to 1.

  • @ashishdevade7209
    @ashishdevade7209 3 года назад

    👍👍👍

  • @ProgrammingwithPeter
    @ProgrammingwithPeter 5 лет назад

    Basically when you want to extend the "class" functionality

  • @Serjgap
    @Serjgap 5 лет назад

    you should use a class instead

    • @AllThingsJavaScript
      @AllThingsJavaScript  5 лет назад +4

      Later in the video I show an example of a class even though I'm not a fan of the class structure. It is simply syntactic sugar that masks the use of prototypes.

    • @bordertone_5138
      @bordertone_5138 4 года назад

      @@AllThingsJavaScript +1