Learn JavaScript INHERITANCE in 7 minutes! 🐇

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

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

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

    // inheritance = allows a new class to inherit properties and methods
    // from an existing class (parent -> child)
    // helps with code reusability
    class Animal{
    alive = true;
    eat(){
    console.log(`This ${this.name} is eating`);
    }
    sleep(){
    console.log(`This ${this.name} is sleeping`);
    }
    }
    class Rabbit extends Animal{
    name = "rabbit";
    run(){
    console.log(`This ${this.name} is running`);
    }
    }
    class Fish extends Animal{
    name = "fish";
    swim(){
    console.log(`This ${this.name} is swimming`);
    }
    }
    class Hawk extends Animal{

    name = "hawk";
    fly(){
    console.log(`This ${this.name} is flying`);
    }
    }
    const rabbit = new Rabbit();
    const fish = new Fish();
    const hawk = new Hawk();
    console.log(rabbit.alive);
    rabbit.eat();
    rabbit.sleep();
    rabbit.run();

  • @ArinAkaMazu
    @ArinAkaMazu Год назад +17

    Yo bro seriously how do you manage to be such a goat like lord I fricking love your tutorials you make everything look so easy

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

    Don't have time to watch as I'm heading out but had to instalike,
    Keep at it bro.

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

    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.

  • @KarthickRajendran-y2v
    @KarthickRajendran-y2v Месяц назад

    Excellent tutorial. Thanks for sharing

  • @SimpleAverageBoi69
    @SimpleAverageBoi69 Год назад +2

    Bro bro bro u a legend ❤❤❤❤❤❤❤

  • @Nedigital__lol
    @Nedigital__lol Год назад +2

    ❤ waiting for more videos Bro(fourth day)

  • @speroakpo4630
    @speroakpo4630 11 месяцев назад +1

    Amazing job man!

  • @manojpatra4458
    @manojpatra4458 5 месяцев назад +2

    Nice explanation. However, I wonder why you didn't use constructor in any of the classes. Will anything get changed with constructors in inheritance?

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

    Thank you

  • @navnitkhandait6750
    @navnitkhandait6750 10 месяцев назад +1

    really a true bro code

  • @sanjay9970
    @sanjay9970 10 месяцев назад +1

    excellent explanation

  • @PrincessTatiana88
    @PrincessTatiana88 Месяц назад +1

    "They're eating the dogs. They're eating the cats"

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

    I'm wondering if dev tools have validation features for code inconsistencies like calling a method that doesn't exist or trying to use an unexisting variable/attribute (is there a vscode extension for this?). in Java for example those are detected in compile time, i.e. you need to fix them to get to run the code (the IDE also warns about them to help save time)

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

    bro, can you make a video on hashmaps

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

    Very much good 😂!

  • @malikgulraiz3659
    @malikgulraiz3659 Год назад +2

    We want react js tutorials
    👇

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

    thanks bro 😂

  • @PrAvEeN.__.
    @PrAvEeN.__. Год назад

    Bro make a tutorial to download the Java for full stack developer in laptop
    Asking for sis

  • @FuadTesfaye-e1b
    @FuadTesfaye-e1b 5 месяцев назад

    bro please teach us typeScript

  • @KD-tp6er
    @KD-tp6er 2 месяца назад

    I'm learning JS, and thought you needed to use constructors within classes to define properties, am I missing something?

  • @muxxxe
    @muxxxe Месяц назад

    bro code >