Object Oriented JavaScript Tutorial #5 - Class Constructors

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

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

  • @paudelamarianaoancea3761
    @paudelamarianaoancea3761 4 года назад +105

    finally somebody that knows to explain.

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

    Clear, concise and beginner friendly.
    Finally someone that knows how to teach to people who are new to code!
    It can be so frustrating trying to find digestible lessons on YT!

  • @kevinparker2314
    @kevinparker2314 2 года назад +2

    I have watched so many tutorials and im taking classes on Coursera. Nobody has come close to making this make sense for me the way that you have. By far the BEST explanation ive ever heard Thank You! I will be subscribing.

    • @NetNinja
      @NetNinja  2 года назад +1

      Wow, thanks for the kind words Kevin :) much appreciated and welcome aboard!

  • @Weykent
    @Weykent 2 года назад +1

    All I can say is thank you. My friend lent me access to a course worth hundreds of dollars and your videos are way clearer and to the point. Amazing 👏

    • @NetNinja
      @NetNinja  2 года назад +1

      Wow, thanks for the kind words Weykent :) means a lot!

  • @alirasheedmd
    @alirasheedmd 3 года назад +1

    For one year almost I was struggling with classes avoided using it in the projects but today I can say I got it! Seriously this is the best tutorial I saw on classes. Loved it!

  • @mk17173n
    @mk17173n 3 года назад +2

    Man i struggled with explanation of constructor function and the "this" keyword and you explained it so well. Earned a sub.

  • @raymondmichael4987
    @raymondmichael4987 6 лет назад +50

    Now when I feel like I need a basic knowledge of something, I first browse all the series found on Ninja Channel, better explanation as always; keep the good work

  • @Ludzi7
    @Ludzi7 3 года назад +1

    Omg you deserve a medal on how to explain code in such a way that even a none programmer can understand. Bravo, keep up the good work!

  • @Mikemillering1
    @Mikemillering1 5 лет назад +100

    Is this really easy to understand or are you just really good at explaining it? Either way, I don't really care because it makes sense! Great Video.

    • @BADLEMONART
      @BADLEMONART 3 года назад +1

      i think somehow other videos have a way of making this seem 10x harder... and he makes this seem 10x easier 🤩

    • @breawen
      @breawen 2 года назад +1

      i always see these kind of comments everywhere and I thought that most people are lying but this really did make it more understandable. in fact, in every oop videos i've watched, this is the only one that i saved on my playlist

  • @dwighthayles1226
    @dwighthayles1226 2 года назад +6

    I kind of grasped this concept before. However, this explanation along with practice helped me to consolidate this idea. I'll be coming to this channel more often. Thanks for the help!

    • @NetNinja
      @NetNinja  2 года назад +1

      That's great to hear Dwight, thanks for your support!

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

    I've struggled to understand the concept in other programming languages but the way you've explained the subject by first showing how to write standalone objects and seconly how to create them dynamically via classes is that missing gap I've had for a long time. Thanks a whole lot! You're incredible!

  • @anthonymclean1918
    @anthonymclean1918 3 года назад +1

    Netninja is so great. Every time I get stuck at some point in a long course elsewhere, I come to this channel to see individual topics explained much more clearly. Thank you :D

  • @safintheship
    @safintheship 4 года назад +8

    watched like 10 videos on constructors each more than 10mins long, then I come across this video. thank you.

  • @vela-6
    @vela-6 4 года назад +1

    Dude. You're 1 million times better at explaining than any other person I've seen on RUclips or Udemy. I swear all other tutorials on anything web dev speak to me as if I'm a robot. I am not a robot, thank you for teaching humans as humans.

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

      Thank you, glad you like :)

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

      same here

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

      you should really watch the stuff from 'Dev Ed' then. Both on youtube and his actual courses. Makes it easy to understand and it's funny at the same time.

  • @PhoenixToluwa
    @PhoenixToluwa 2 года назад +5

    As a school teacher I AM IMPRESSED! you taught well my friend

  • @Cho1279624
    @Cho1279624 6 лет назад +15

    Wow! The 'class' is used in that way. I always write the codes in like "function User(email, name){ this.email = email; this.name = name}". Maybe there are some reasons why they grabbed the 'class' into Javascript. I expect you, the Net Ninja, to explain well as always! I appreciate your teaching all the time!

    • @tiaan_va
      @tiaan_va 4 года назад +4

      Classes were never a thing in the past within JS. What you just described is creating a constructor function, that was the old way to create these type of objects, but when it came down to the prototype and inheritance the required code just looked horrible and difficult to read, thus with a newer version of JS classes were introduced to replace the old classic constructor functions. Both do the same thing, the code is just much easier to manage later down the line with classes.

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

    Have been struggling with this, getters and setters and you have truly just made it so simple. Thank you!

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

    Hi, I have to say I have just been accepted into Lambda School for Dec/Jan, having you to watch as my goto study material is just amazing.
    The way you explain everything in depth and complete detail is absolutely brilliant for someone like me who is a complete novice to coding/web dev, you give me confidence that I can come to your videos and if I didn't understand the concept before watching, I will after watching.
    Thank you @The Net Ninja

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

      Awesome, thank you and congrats! :)

  • @vaylx2253
    @vaylx2253 3 года назад +1

    Easily the best explanation for constructors I've seen so far.

  • @asken5139
    @asken5139 2 года назад +1

    I really really like your way of explaining things. You take nothing for granted when you explain the concepts, which is really helpful. I've been doing another course,, which I actually like, but you explain things, so I get it immediately! You have a new fan:-)

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

    It one of the best description of classes and constructors I've ever heard. You're rock man! Thank you.

  • @chrismaxwell8347
    @chrismaxwell8347 3 года назад +1

    I've done exercises similar to this one, but this is the first time I actually understand what and more importantly why we do this. Bravo sir 👏

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

    I love how you explained this man, it was so dumbed down and easily understood. I understand constructors better than ever now

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

      That's awesome to know :) thanks for watching

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

    Been searching for an explanation for constructors for too long but here you are!! thanks a lot

  • @JadeHarris-h9m
    @JadeHarris-h9m Год назад +1

    An amazing teacher who has a superb way of explaining things! so much better than other tutorials! Thank you so much for the material you provide!

  • @Soap_js
    @Soap_js 3 года назад +1

    best programming tutorials channel fast and understandable!

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

    Thanks for making 'classes' much easier for me, I love the way you explain.

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

    You are really good at explaining for real. I have been struggling with this for almost a week. Thank you so much

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

      Awesome, glad it helped :)

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

    By far the most useful video on the subject I have found. Truly able to explain it so that a beginner like myself can understand and digest the concepts. Thank you.

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

      Glad it was helpful! :)

  • @naveedalirehmani4135
    @naveedalirehmani4135 4 года назад +2

    thank you very much these tutorials are the best absolutely easy to understand and the example you use to teach are very easy and relevant

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

    Brilliantly explained. Straight to the point.

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

    my gratitude for this video right here is so *astronomical*

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

    Absolutely fantastic tutorials, wished I'd come across this years ago when I started off. Anyway, not to be pedantic, but that 'new' key word actually does four things - the first three as you mentioned including the fourth which is returning the object instance it created.

  • @TheMarioProductionz
    @TheMarioProductionz 6 лет назад +4

    Cleanest explanation so far, thank you very much!

  • @dividedbyzero0
    @dividedbyzero0 2 года назад +1

    Flawless Tutorial. You explained everything so well!
    Thank you so much 😀

    • @NetNinja
      @NetNinja  2 года назад +1

      Glad it was helpful! :)

  • @zoltancaputo9562
    @zoltancaputo9562 2 года назад

    AWESOME , you make it simple... this.teacher = 'true teacher' Iol tks a lot for alll knowledge shared!

  • @ubarjaktarev
    @ubarjaktarev 2 года назад

    Best explanation available online. Thank you so much!

    • @NetNinja
      @NetNinja  2 года назад

      You're welcome! :) hope it was helpful

  • @nasiruddin2638
    @nasiruddin2638 6 лет назад +2

    Love this series. Waiting for the next part.

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

    Thanks, your explanation is so simple and on point. I understand better now.

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

    Clearly understandable and minimalistic video

  • @hannahjoynson8937
    @hannahjoynson8937 2 года назад

    Absolute legend great way of explaining

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

    Thanks a lot for your thorough explanation, at last, could find a video where everything was clear. Once again thanks for your efforts.

  • @Teteu.freitas
    @Teteu.freitas 3 года назад

    Brave! That's why you have 700k subscripts! Keep Growing! Thanks

  • @JS-zm5se
    @JS-zm5se 4 года назад

    Simply genius explanation

  • @daniellaerachannel
    @daniellaerachannel 6 лет назад +1

    always nice these refreshing video on JS! thanks

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

    Brilliantly explained. Thank you!

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

    Godlike explanation. Thanks a million

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

    You are so amazing. So clear and concise explanations. I have one confusion right now though, I have learned from older updates of JS about constructor functions when creating new objects, so how are classes different from construct functions and when should I use classes and when should I use just plain constructor functions? Thanks man keep it up!

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

      Don't use constructor functions now as classes are there.

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

    Something worth watching Thnx for the Great Lesson ✌️ !

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

    Woooooo.... Your explanation was AMAZING... Thank You...💝💝💝💝💝

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

      You're welcome 😊

  • @justdewmina
    @justdewmina 2 года назад

    WOW! Putting across very nicely...!

    • @NetNinja
      @NetNinja  2 года назад

      Thank you! Cheers!

  • @tajahouse4678
    @tajahouse4678 5 лет назад +1

    Awesome job explaining this!

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

    OMG ,,,, this video is the best among 10 oop videos I already saw ,,,,,,, thanks bro

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

    This man explained something actually no, he explained all I need to know. he needs like a 2m sub for the precise, accurate explanations he does. #ThisManIsALegend my teacher couldn't explain this...
    nothing more to say alas I am at peace...

  • @Er1cAI
    @Er1cAI 2 года назад

    Beautiful explanation! Thank you

    • @NetNinja
      @NetNinja  2 года назад

      You're very welcome! :)

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

    Thank you for the explanation! 🙌🏻 Good video

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

    the "new" keyword let you create these {objects}. class is just syntactical sugar: try to instantiate a normal "function declaration" by using the "new" keyword and it will return the same value as long as you use "this" in declaring its properties(this.property = 'somevalue'). any normal function RETURNS "this:{prop1: value1, prop2: value2,...}" by DEFAULT as long as we use the "new" key word when instantiating. a CONSTRUCTOR inside a class does the same thing regarding this feature. the difference between a "class" and a "function declaration" is its naming convention as to where normal functions use "camelCase" but in class we use "PascalCase". in the early days the old Javascript engine inside our BROWSERS use functions similar to classes(today). this naming convention was made to avoid CONFUSION bet. a normal function vs a function being instantiated(new) with "this:{}" inside of it. normal functions does not RETURN "this" by default, only when instantiated using "new". Hope it helps.

  • @Martin958
    @Martin958 3 месяца назад

    Don't forget to mention that the 'new' keyword automatically returns the newly made object to the variable name that called the User class in the beginning.

  • @ashleysaleem-west5485
    @ashleysaleem-west5485 5 лет назад +2

    What are the benefits using the new class syntax over simply using a constructor object on its own?

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

      It makes the code when coming to inheritance between constructors (and other stuff) muuuch easier to read (and remember).

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

    This was super helpful! thank you!

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

    very solid explanation thank you

  • @user-wn7et1ft9j
    @user-wn7et1ft9j 3 года назад

    THIS HELPED SO MUCH! thanks

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

    #The_Net_Ninja is the best teacher

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

    Thanks! It’s really helpful! 🙏

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

    Thank you man ! I now understand constructors ! Thumbs up to u !

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

    Great explanation!

  • @sandrarodgers3071
    @sandrarodgers3071 6 лет назад +1

    This was extremely helpful. Thank you!

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

    Wow, totally get it now!!!!

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

    thank you ver much for the very wel explained lessons. Great jon. A question on the var you use ? i did understand ( unless i am wrong ) that the old var was in more recent versions of JS replaced by the let and const because of ' scope ' reasons an the difference between var and let there . Is there a reason you use var here ? Would this also work with let ?

  • @gazorbpazorbian
    @gazorbpazorbian 6 лет назад

    awesome video, keep em coming!, also I hope you also explain managing databases with OOP

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

    this is what a ninja means

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

    💯🔥godninja

  • @c.burhan55sw
    @c.burhan55sw 5 лет назад

    great description thx sir keep up the great work

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

    It just saved my life

  • @SunilKumar-fh6jk
    @SunilKumar-fh6jk 6 лет назад

    Love you bro, you are truly a ninja! Love

  • @dukgame4116
    @dukgame4116 6 лет назад +2

    Back With Visual Studio Code

  • @tawsif-karim
    @tawsif-karim 6 лет назад

    great explanation...waiting for more...

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

    Helpful thanks 👍

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

    Wonderful pedagogy! Thank you
    I subscribe!

  • @DevlogBill
    @DevlogBill 2 года назад

    Appreciate your videos

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

    Short and sweet
    😗

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

    I love you, ma dude!

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

    you're my favourite!

  • @josesuch4962
    @josesuch4962 3 года назад +1

    Nice!!!!

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

    Man made it easy

  • @Behold-the-Florist
    @Behold-the-Florist 4 года назад +1

    Is there any real benefit to using classes over regular constructor functions to make a new object of a certain type?

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

      Have you found the answer?

    • @Behold-the-Florist
      @Behold-the-Florist 3 года назад

      @@ayushuprety5676 Having methods come from the prototype rather than being part of every instance of the object you create will prevent unnecessary memory stores. I'm not sure how to word it but hopefully you can look it up! :)

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

      @@Behold-the-Florist yeah thanks I got it

    • @Behold-the-Florist
      @Behold-the-Florist 3 года назад +1

      @@ayushuprety5676 :) All the best!

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

    Thank you very much!

  • @leweed3049
    @leweed3049 2 года назад

    Thank you this helped alot

  • @DevlogBill
    @DevlogBill 2 года назад

    Hi Net Ninja, I noticed you mentioned ES6 standards for these courses but I noticed your still using var instead of let or const. Was the key and const added for ES6? Or am I mistaken?

  • @Rawxpphey
    @Rawxpphey 2 года назад

    good explanation

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

    noticed you were still replying to comments so I just wanna say great tutorial, but also how do you get the notifications for caps lock? it seems pretty cool ngl

  • @willadams6217
    @willadams6217 6 лет назад

    What are your thoughts on choosing composition over inheritance?

  • @kamrannawaz5106
    @kamrannawaz5106 6 лет назад +2

    why most of the developers use constructor function and not the classes ? is using class is worth ?

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

      Probably because they have it as a habit from ecmascript 5,i think classes look more elegant,and more efficient too;

  • @rihanulkarim3997
    @rihanulkarim3997 6 лет назад

    Tnx a lot man. U just saved my ass. Subbed

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

    thats the most easiest answer i got here in youtube.

  • @asaduzzaman5356
    @asaduzzaman5356 6 лет назад +6

    carry on bro go on

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

    love it

  • @icaruz9094
    @icaruz9094 2 года назад

    THE PRECISE EXPLANATION SO FAR!!!!!

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

    You said the constructor function creates object, but then you later said the "new" creates object. Do they both create new object?

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

    thanks