JavaScript CONSTRUCTORS in 5 minutes! 🛠

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

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

  • @BroCodez
    @BroCodez  Год назад +8

    // constructor = special method for defining the
    // properties and methods of objects
    function Car(make, model, year, color){
    this.make = make,
    this.model = model,
    this.year = year,
    this.color = color,
    this.drive = function(){console.log(`You drive the ${this.model}`)}
    }
    const car1 = new Car("Ford", "Mustang", 2024, "red");
    const car2 = new Car("Chevrolet", "Camaro", 2025, "blue");
    const car3 = new Car("Dodge", "Charger", 2026, "silver");
    console.log(car1.make);
    console.log(car1.model);
    console.log(car1.year);
    console.log(car1.color);
    console.log(car2.make);
    console.log(car2.model);
    console.log(car2.year);
    console.log(car2.color);
    console.log(car3.make);
    console.log(car3.model);
    console.log(car3.year);
    console.log(car3.color);
    car1.drive();
    car2.drive();
    car3.drive();

  • @existentialcrysis9850
    @existentialcrysis9850 3 месяца назад +7

    Thank you man ,this was super concise and helpful. You made something complicated so easy in just 5 minutes. Cheers !

  • @amitd1572
    @amitd1572 10 месяцев назад +14

    Well explained. Possibly one of few videos to cover it so well.

  • @bamidelekarimu1218
    @bamidelekarimu1218 9 месяцев назад +3

    Thanks for taking the time to share this. Very explicit; it was so difficult tfor me to understand this term. Now it's clear to me; thanks indeed.

  • @RedHeadphones
    @RedHeadphones Год назад +1

    dude, i love your videos, you wont believe how much better you taught me javascript than those 12 hour courses

  • @michellegutierrez4690
    @michellegutierrez4690 9 месяцев назад

    Thank you for sharing it! It was easy to understand ! Keep up the good work!

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

    This is my seal. I have watched the entire video, understood it, and I can explain it in my own words, thus I have gained knowledge. This is my seal.

  • @osmane888
    @osmane888 9 месяцев назад +1

    thanks a lot dude ! Your videos already helped me understand some SQL concepts (that i needed for my classes) and now you helped me with that concept. Your explainations are crystal clear because it's explained in simple words and are exhaustive, so thanks !

  • @chuksbrian3380
    @chuksbrian3380 5 месяцев назад

    best explanation i found on youtube. thanks bud

  • @jakobo5521
    @jakobo5521 10 месяцев назад

    Simple as that. This is what I was looking for. Thanks a lot!

  • @hoanginh1437
    @hoanginh1437 6 месяцев назад

    thats a really fast lessons, i love that, tks mate

  • @024-venkateshkondaparthi2
    @024-venkateshkondaparthi2 2 месяца назад

    All cars are amazing 😎

  • @ParissYoungblood
    @ParissYoungblood 9 месяцев назад +3

    Is there a reason why you did not use ES6 Class Constructor?

  • @Sunny-uk5fz
    @Sunny-uk5fz 11 месяцев назад

    This was super helpful. Thanks Bro!

  • @lunasoleil2827
    @lunasoleil2827 11 месяцев назад

    Very helpful video

  • @Mirror601
    @Mirror601 5 месяцев назад +1

    ❤❤❤ thanks 🙏

  • @PurpleGamechill
    @PurpleGamechill 12 часов назад

    3:45 BroCode sounded like daft punk "dodge, charger"

  • @RABWA333
    @RABWA333 8 месяцев назад

    thanks a lot, quite clear

  • @AhmedAlbably
    @AhmedAlbably 8 месяцев назад

    creative as usual

  • @tomlaskar4226
    @tomlaskar4226 7 месяцев назад

    Thank you.

  • @szymonpiechutowski2340
    @szymonpiechutowski2340 Год назад +1

    Did you use a function to create Car because the only other way to create a template for an object is class?

    • @BroCodez
      @BroCodez  Год назад +1

      I talk about classes in the next video

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

    Thanks brother

  • @GordonChao0508
    @GordonChao0508 10 месяцев назад

    Does JavaScript constructor method similar with Python “self” method?

  • @futrozryby8474
    @futrozryby8474 4 месяца назад

    Why in the constructors are "," and not ";"?

  • @banjoller
    @banjoller 10 месяцев назад

    pls make tut in node.js

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

    Bro can you teach us Laravel pls?🥺

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

    please which software do you use for screen recording?

    • @lmao64
      @lmao64 4 месяца назад

      You can use obs studio or bandicam to record your screen

  • @Monray87
    @Monray87 5 месяцев назад

    constructors looks a lot like objects in java.

  • @EledeRR
    @EledeRR Год назад +5

    When you say "I gotta explain constructers" it sounds like you're being forced

  • @Mohammadshahid-v9r
    @Mohammadshahid-v9r Год назад

    Hii sir,
    Which JAVA version is best for beginners -> JAVA 17 or JAVA 21 in 2023

    • @_mo1zz17
      @_mo1zz17 4 месяца назад

      Ecma 6 is best for beginners

  • @WitchDimension
    @WitchDimension 6 месяцев назад +2

    The way people break down constructors is very onfusing

  • @jayroche135
    @jayroche135 7 месяцев назад +1

    I can't get over... "this." Pun very intended... but seriously... why do we have to set "this.year = year"
    "this.model=model"
    Like... I am not understanding that...

    • @holy_shushcabin3716
      @holy_shushcabin3716 7 месяцев назад +1

      Nice pun. this. is also seen in C++ (this->), and it helps when you don’t want to come up with a name for a parameter (which is one of the hardest feats in programming). this. also refers to the current instance of the class or object.

    • @hamzagohar2048
      @hamzagohar2048 4 месяца назад +1

      @@holy_shushcabin3716
      ohhh thank you so much man I had the same question in mind