JavaScript Classes Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ธ.ค. 2024

ความคิดเห็น • 260

  • @dcode-software
    @dcode-software 6 ปีที่แล้ว +330

    Sorry about the light theme! I'll promise to use a dark theme for all my future videos 😁

    • @magakz
      @magakz 6 ปีที่แล้ว +4

      Which theme is that ?

    • @dcode-software
      @dcode-software 6 ปีที่แล้ว +8

      @@magakz from memory that one is the Brackets Light theme

    • @ahmedk575
      @ahmedk575 6 ปีที่แล้ว +6

      light theme is better for people with sight problems

    • @clarkrc82
      @clarkrc82 6 ปีที่แล้ว +38

      Yeah but light theme causes sight problems for those of us who DONT have sight problems lol

    • @WisdomStacks
      @WisdomStacks 6 ปีที่แล้ว +4

      I know it sounds odd, but I work with light themes. 😅 And this theme is really good!

  • @karinmeersman5123
    @karinmeersman5123 6 ปีที่แล้ว +53

    beautifully explained. I especially appreciate the fact that you show how classes can be used in real situations. Often that is missing and then the explanation will not stick. I loved it!

  • @KevinRamirez-vw5kv
    @KevinRamirez-vw5kv 4 ปีที่แล้ว +15

    Best video I've seen on classes. First time they really made sense.

  • @BernardoGuerreiro-d8m
    @BernardoGuerreiro-d8m ปีที่แล้ว +8

    I've been studying for 6 months. I aspire to be a web developer.
    In my 6 months, of all the topics i had to learn, this was the best teaching video I've watched. Also, I never comment, but this time I had to.
    Thank you,

  • @totfosk
    @totfosk ปีที่แล้ว +3

    Dom is the best. The fact that he used underscore on the argements to not get more confusing is key. Most of the tutorials just put this.abc = abc and it's very confusing.

  • @starnsboy
    @starnsboy 6 ปีที่แล้ว +23

    This is great! Do not be put of by the 1 hour length. Its worth a watch!

  • @jacobwilsh8517
    @jacobwilsh8517 3 ปีที่แล้ว +8

    This was a great tutorial. Concise, clear, straight to the point. Thank you

  • @freecodecamp
    @freecodecamp  6 ปีที่แล้ว +4

    Here are some more JavaScript resources:
    JavaScript basics course: th-cam.com/play/PLWKjhJtqVAbk2qRZtWSzCIN38JC_NdhW5.html
    Another JavaScript course: th-cam.com/video/_y9oxzTGERs/w-d-xo.html
    Learn JavaScript in a text-based curriculum: www.freecodecamp.org

  • @Zsh3107
    @Zsh3107 ปีที่แล้ว +1

    I searched a lot to find this amazing class toturial. I can't say how thankful I am. It was the best explanation for class on the internet. God bless you❤🙏🏽

  • @PapaWilk
    @PapaWilk 2 ปีที่แล้ว +3

    on-screen tutorials like this are such a valuable resource. I followed along until the Classes in Practice section. I lost sight of what we were doing and why we would want to be doing it on our website. While I lost sight of the "big picture," the author's attention to detail was impeccable. Good video.

    • @ChrisTian-ox5nr
      @ChrisTian-ox5nr ปีที่แล้ว

      OOP can be especially beneficial when building complex websites or applications where you need to model different entities, such as users, products, or orders, and their interactions. It provides a clear and structured way to represent and manipulate these entities in your code.

  • @Kayotesden
    @Kayotesden 4 ปีที่แล้ว +5

    A wonderful & comprehensive revision of basics on Classes. I loved it. Thank you.

  • @EsnoFava
    @EsnoFava ปีที่แล้ว +1

    Thanks, I hate reading MDN docs, this is so much better.

  • @natashaswan7731
    @natashaswan7731 2 ปีที่แล้ว +1

    This is super helpful! I watched many videos on OOP but this one by far more explanatory than all of them. THANK YOU!!!!

  • @RosanaMoreno-vm5df
    @RosanaMoreno-vm5df 2 ปีที่แล้ว +1

    Thanks a lot for the beginner-friendly classes' lesson!!! It was easy to understand and entertaining to watch

  • @sumanboi
    @sumanboi 3 ปีที่แล้ว +10

    "the programmer issa special type of person" 36:00 killed me 😂 🤣

  • @burgerxxiii
    @burgerxxiii ปีที่แล้ว

    I finally conquered javascript classes basics, thanks to you!

  • @JamesShisiah
    @JamesShisiah 3 ปีที่แล้ว +2

    This is how front end frameworks are made, from minute #46. Great tutorial

  • @shashankthapa659
    @shashankthapa659 2 ปีที่แล้ว +1

    Thank god it took me 10 hours to watch and practice it throughly. Now, Im through! Thanks a lot coach!

  • @dev4SEO
    @dev4SEO 6 ปีที่แล้ว +12

    Thank you. I liked the video, it is good and I've learned quite a bit. Just one thing about the last example of DOM manipulation - it was a bit harder to understand, because I felt that not all was laid out in a clear and correct order, so it was a bit confusing. But still - great job, thanks again.

  • @Fishamble
    @Fishamble 2 ปีที่แล้ว

    Thank you. I very mush appreciated the example with an actual real world implementation of a class.

  • @TomFoley247
    @TomFoley247 2 ปีที่แล้ว

    Thank you so much. I've found this playlist to be the best JS Classes tutorial out there.

  • @eliasvasques80
    @eliasvasques80 2 ปีที่แล้ว +2

    Ohhh, fantastic tutorial, thanks for the lesson!

  • @sivko23
    @sivko23 6 ปีที่แล้ว +96

    who else loves the sound of keyboard?

    • @erniea5843
      @erniea5843 5 ปีที่แล้ว +3

      seriously, get a mic!

    • @sfoxj
      @sfoxj 4 ปีที่แล้ว

      Me

    • @jepqmw
      @jepqmw 3 ปีที่แล้ว +1

      sound of keyboard is pretty cool but on white theme background it sucks :'(

    • @xi_red4936
      @xi_red4936 3 ปีที่แล้ว

      It gives me chills lol

  • @dansmar_2414
    @dansmar_2414 2 ปีที่แล้ว +1

    One of the best tutorials!

  • @bekhzodbeknematov
    @bekhzodbeknematov 3 ปีที่แล้ว

    a perfect explanation with examples , i would appreciate

  • @АринаСамукова
    @АринаСамукова ปีที่แล้ว

    Enjoyed every second of the tutorial! Especially the practice part. Thank you a lot ;)

  • @Larreth
    @Larreth 3 ปีที่แล้ว

    The best OOP lesson i've ever taken!

  • @frankylopez4477
    @frankylopez4477 3 ปีที่แล้ว +1

    Thanks, i liked it a lot. Its really concise and easy to understand. This help a lot for the basics.

  • @maujadiprogrammer
    @maujadiprogrammer 3 ปีที่แล้ว +2

    thank you for the tutorial, it really helps me out.

  • @fatemeetsluck
    @fatemeetsluck 4 ปีที่แล้ว

    This video inspired me to add get and set properties to my own scripting language. Great video as always!

  • @herentran
    @herentran ปีที่แล้ว

    Thank for the explanation. Espcially the real situation.

  • @brightprogrammer
    @brightprogrammer 2 ปีที่แล้ว

    short, compact and to the point

  • @sowmyakonkala1046
    @sowmyakonkala1046 7 หลายเดือนก่อน

    very nice video for the first time it did not feel like its an hour video

  • @CianaCorto
    @CianaCorto 5 ปีที่แล้ว +1

    A very helpful refresher course! Thanks Dom!

  • @ericlanglaismm
    @ericlanglaismm 2 ปีที่แล้ว

    Dom, what a great name for a web developer!

  • @স্বচ্ছনিরবতা
    @স্বচ্ছনিরবতা 3 ปีที่แล้ว

    Amazing amazing amazing.
    Absolutely loved it.
    Thank you very much.

  • @yadikishameer9587
    @yadikishameer9587 2 ปีที่แล้ว +1

    This might be the first tutorial I have seen that's in bright mode 🤪

  • @dapolcio3405
    @dapolcio3405 2 ปีที่แล้ว

    I think this is the only tutorial on youtube where classes are shown in practice. Other tutorials only show theory so to speak and watching them you don't know how to use this theory in real life application.

  • @markm8090
    @markm8090 3 ปีที่แล้ว +5

    Although I'm close to completing a Udemy course, this vid has helped me to understand this part better. Know that this is an old video, but maybe would be better using dark mode in VS (little difficult for me to see the code on my screen). Thanks, love the tutorials! :)

    • @DineshKumar-jt5tr
      @DineshKumar-jt5tr 2 ปีที่แล้ว

      bro can suggest me good javascript course in udemy for begginer to advance

  • @tyresew.4233
    @tyresew.4233 6 ปีที่แล้ว +8

    This is free information!!!

  • @kels-nz9if
    @kels-nz9if 2 หลายเดือนก่อน

    thank you so much for this masterpiece 🙏

  • @ingavaiciakauskaite3485
    @ingavaiciakauskaite3485 6 ปีที่แล้ว +2

    Great tutorial, excellent explanations, thanks a lot!

  • @henrysemaganda9587
    @henrysemaganda9587 3 ปีที่แล้ว

    Great video, you have made my career !!

  • @hazemabdo522
    @hazemabdo522 2 ปีที่แล้ว

    what a very cool tutorial ❤❤.

  • @thabosiphiwemngoma4772
    @thabosiphiwemngoma4772 3 ปีที่แล้ว +2

    He's name is DOM can there a better teacher for this class? Oh man!!! great class and very constructive lessons(excuse me there). I needed this because I was about to assume that classes were a react.js syntax

  • @Joseph.Ashenafi
    @Joseph.Ashenafi ปีที่แล้ว

    wuu 🤩 , great tutorial

  • @alijoyce2169
    @alijoyce2169 3 ปีที่แล้ว

    CMD + B and CMD + SHIFT + "+" is what this guy needs in his life.

  • @limitless1692
    @limitless1692 3 ปีที่แล้ว

    Great video .
    Neat introduction into the Class syntax and all its keywords .
    Thanks !

  • @schlaus_kwab
    @schlaus_kwab 6 ปีที่แล้ว +1

    repeatedly calling the update method when using add() is a bit confusing. Why does it not remove the "dcode" when you add "dog"? Isn't it supposed to remove all the items if there is already a firsChild dcode? Can you please elaborate more on this? Thank you.

    • @armanrozika
      @armanrozika 6 ปีที่แล้ว +1

      It is in fact remove all the li tags, but after a (while) loop ends/break, it adds child node to it based on the text that added via push method (notice the for loop after while loop inside update function)

  • @joedewhurst6569
    @joedewhurst6569 ปีที่แล้ว

    This has really helped! thanks :)

  • @pedrolelis7854
    @pedrolelis7854 2 ปีที่แล้ว

    Amazing content! Well explained, just to the point! Thanks A LOT!

  • @michaelmellor6061
    @michaelmellor6061 ปีที่แล้ว

    Great content !

  • @tanishpanjwani3117
    @tanishpanjwani3117 3 ปีที่แล้ว +1

    JS teacher named Dom. Nice.

  •  3 ปีที่แล้ว

    Thanks, I always was scared of classes, but now i see it's not thet hard

  • @pearlsswine
    @pearlsswine 4 ปีที่แล้ว

    Thanks for the video! You did a really good job explaining classes, and I really appreciate using an example at the end of what a class would be used to manipulate the DOM. It actually helps understand the usefulness of classes.

  • @djnefrozhardstylepromotion3527
    @djnefrozhardstylepromotion3527 3 ปีที่แล้ว

    Amazing tutorial, makes OOP really easy to dive into !

  • @adnansaiyed8843
    @adnansaiyed8843 2 ปีที่แล้ว

    Last example was beautiful..

  • @fregina3813
    @fregina3813 2 ปีที่แล้ว

    Brilliant class, thx a lot

  • @abhishekkrishna8056
    @abhishekkrishna8056 2 ปีที่แล้ว

    beautifully explained

  • @SpiritMrKatarsis
    @SpiritMrKatarsis 2 ปีที่แล้ว

    Classes are challenging 😅 Thanks for the video. Great explanation)

  • @charanckck
    @charanckck 3 ปีที่แล้ว

    Thank you bro. Very well understood.

  • @MisterAndreSafari
    @MisterAndreSafari 3 ปีที่แล้ว

    Great explaining skills. Thx!!

  • @আমরাব্যাচেলরছেলে

    Great tutorial! Thanks.

  • @sardertuhin796
    @sardertuhin796 2 ปีที่แล้ว

    great explanation

  • @marcinkalmar9964
    @marcinkalmar9964 2 ปีที่แล้ว

    Very good explanation the name of core concept sound very confusing but when it is explain it turn out it isn't hard to absorb.

  • @wieroaisdfjlkds
    @wieroaisdfjlkds 6 ปีที่แล้ว

    What you call "Instance methods" like the getArea method in the rectangle class is actually a prototype method that is shared between all instances of the class.If you were to do something like
    const prototype = Object.getPrototypeOf(myRectangle1);
    prototype.getArea = () => 'i am a new method';
    console.log(myRectangle1.getArea()); // 'i am a new method'
    console.log(myRectangle2.getArea()); // 'i am a new method'
    they would both print out "I am a new method".
    as also shown by the fact that myRectangle1.hasOwnProperty('getArea'); is false
    to be a real instance method the constructor would have to be defined as follows:
    constructor(_width, _height, _color){
    this.width = _width;
    this.height = _height;
    this.color = _color;
    this.getArea = function()
    {
    return this.width * this.height;
    }
    }
    then if we do the following:
    myRectangle1.getArea = ()=> 'i am awesome';
    console.log(myRectangle1.getArea()); // 'i am awesome'
    console.log(myRectangle2.getArea()); // 170
    myRectangle2.getArea() doesn't change this time as it is it's own instance method and this time myRectangle2.hasOwnProperty('getArea'); is true
    also the add method in the listBinding class is not the best example to show, if you have a list of 1000 items and want to add one thing you are doing 1000 deletions and 1001 insertions into the dom which is one of the slowest things you could do.

  • @sfoxj
    @sfoxj 4 ปีที่แล้ว

    You can also create functions that start with capital letters and they will create classes
    Example:
    var Person = function(age, name) {
    This.age=age
    This.name=name
    }

    • @amitkrgupta094
      @amitkrgupta094 2 ปีที่แล้ว

      These are called Constructor function, It's all good but it adds up a little bit of boilerplate when trying to make use of inheritance.

  • @tuxmusicman
    @tuxmusicman 6 ปีที่แล้ว +1

    Fixed my problem with super()! Thank you!

    • @tuxmusicman
      @tuxmusicman 6 ปีที่แล้ว

      I'm still having a problem where the class isn't being updated.

  • @chriseski
    @chriseski 3 ปีที่แล้ว

    Amazing tutorial, really helpfull. Subscription earned!!

  • @mariyahadzhiyska7681
    @mariyahadzhiyska7681 ปีที่แล้ว

    Thank you! The tutorial was really helpful!

  • @asyakim5555
    @asyakim5555 3 ปีที่แล้ว

    really understandable. thank you for your work

  • @muhammadjawad9341
    @muhammadjawad9341 2 ปีที่แล้ว

    Simple & to the point :)

  • @matthewdimicelli4191
    @matthewdimicelli4191 3 ปีที่แล้ว +2

    Can anybody clarify why the coder is using underscores at the beginning of the function parameters (for example, in the constructor methods)? Does this mean that the variables/arguments are not to be used outside of the class (eg. that they are "private" to the class)?

  • @emmanuelobonyo291
    @emmanuelobonyo291 3 ปีที่แล้ว

    Thank you for this.

  • @jrunin
    @jrunin 6 ปีที่แล้ว +1

    excelently explained. Thank you.

  • @yashuverma5399
    @yashuverma5399 3 ปีที่แล้ว

    Awesome tutorial

  • @wikylhr
    @wikylhr 6 ปีที่แล้ว

    Super easy to understand. Thank you

  • @DineshVutukuru
    @DineshVutukuru 4 ปีที่แล้ว

    Beautiful explanation

  • @havefun5519
    @havefun5519 4 ปีที่แล้ว +1

    Thanks for your tutorial, really good.

    • @havefun5519
      @havefun5519 2 ปีที่แล้ว

      Ops, I have watched it 2 years ago, finally I re-watch again.haha

  • @MsSamar2005
    @MsSamar2005 4 ปีที่แล้ว

    excellent tutorial thanks alot

  • @mcurtis13
    @mcurtis13 6 ปีที่แล้ว +23

    Thanks I now understand react lol

    • @slmshady539
      @slmshady539 4 ปีที่แล้ว +2

      yeah in fact I came here because of class-based react components.

    • @limitless1692
      @limitless1692 3 ปีที่แล้ว +1

      Michael Curtis
      Wow this is insane , I mean shouldn't you understand vanilla javascript before working with any framework ?
      Just saying ...

  • @VocalStudioByTen
    @VocalStudioByTen 4 ปีที่แล้ว

    Thank you very much! Very clear!

  • @IGNACIOLUISGOMEZ
    @IGNACIOLUISGOMEZ 4 ปีที่แล้ว +1

    Excellent video!
    I have a question:
    At minute 59:12 the method "add" is executed. The "add" method has the "update" method inside. Shouldn't the "update" method remove the "firstchild" from the list?
    Thanks for so much teaching!

    • @nouvalkaf
      @nouvalkaf 3 ปีที่แล้ว +1

      "update" method does not remove the "firstchild" anymore within "add" since Dom deleted it at minute 56:18. That eventually the "while" part within the "add" method was not executed.

  • @binitrupakheti4246
    @binitrupakheti4246 3 ปีที่แล้ว

    I love your keyboard sound

  • @sonamuhialdeen7866
    @sonamuhialdeen7866 3 ปีที่แล้ว

    Awesome tutorials

  • @Ali-lm7uw
    @Ali-lm7uw 6 ปีที่แล้ว +1

    Nice tutorial. Is there anymore to OOP than this or is knowing this enough?

  • @mattyblake9427
    @mattyblake9427 2 ปีที่แล้ว

    this is wonderful

  • @rossfindlay5375
    @rossfindlay5375 6 ปีที่แล้ว

    Great lesson, thanks!

  • @lesterdimitresque6315
    @lesterdimitresque6315 2 ปีที่แล้ว

    so to sum up what classes (in js) are : they are similar to functions ? but are being used to store objects and values ? did I get that right ?

  • @josecordero3077
    @josecordero3077 3 ปีที่แล้ว

    I like your OOP style.. it’s almost the same as c#

  • @AkaExcel
    @AkaExcel 6 ปีที่แล้ว +2

    Thank You for your useful video!

  • @knightonhd1144
    @knightonhd1144 6 ปีที่แล้ว +1

    Good stuff 👍

  • @ThisIsLiving__
    @ThisIsLiving__ 5 ปีที่แล้ว +2

    I have a question. Why should i use the classes instead of using a function constructor to create a new object and assign properties and method to it

    • @alsonick
      @alsonick 4 ปีที่แล้ว +2

      It's literally just syntactic sugar, it's just to make the code look much better and cleaner for programmers.

  • @carmelon8917
    @carmelon8917 6 ปีที่แล้ว

    Useful lesson!

  • @spicy_bala
    @spicy_bala 3 ปีที่แล้ว

    Eye heavy pain while seeing light theme. But your teaching awesome. Thanks

  • @envisionstudio2512
    @envisionstudio2512 3 ปีที่แล้ว

    Super bro...!

  • @myankpraksh
    @myankpraksh 2 ปีที่แล้ว

    Thank you so much.

  • @joostvoncken950
    @joostvoncken950 5 ปีที่แล้ว

    You just took me too the next level. Thanks!

  • @raghumesta26
    @raghumesta26 6 ปีที่แล้ว

    Thank you for your effort!