Premium Only Content
This video is only available to Rumble Premium subscribers. Subscribe to
enjoy exclusive content and ad-free viewing.

Learn JavaScript INHERITANCE in 7 minutes! 🐇
1 year ago
32
Automotive
Education
Programming
Coding
Software Development
Web Development
Mobile App Development
Computer Science
Coding Tutorial
Code Learning
Programming Language
// inheritance = allows a new class to inherit properties and methods
// from an existing class. 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();
Loading comments...
-
LIVE
vivafrei
4 hours agoPam Bondi War on “Hate Speech”? Kash Patel Grilled by Senate & More!
5,583 watching -
DVR
The Quartering
2 hours agoCharlie Kirk Assassination Appears In Court!
144K33 -
Awaken With JP
1 hour agoAmerica Rocked by Charlie Kirk Death - LIES Ep 108
16.6K9 -
1:05:13
Russell Brand
3 hours agoReporting From Tommy Robinson’s ‘Unite the Kingdom’ March - SF634
91.7K50 -
LIVE
Rallied
1 hour ago $0.10 earnedWarzone Challenges All Night
67 watching -
55:05
Committee on House Administration
1 day agoSubcommittee on Elections Hearing:“Maintaining Election Operations in the Face of Natural Disasters”
2.65K -
5:56
Buddy Brown
3 hours ago $2.53 earnedThis is Why Everyone's Googling September 23rd! | Buddy Brown
16.6K18 -
58:33
Human Events Daily with Jack Posobiec
2 hours agoHUMAN EVENTS DAILY WITH JACK POSOBIEC
17.7K1 -
3:21
Michael Heaver
3 hours agoGermany’s Seismic Result Serves WARNING
5.86K3 -
1:02:14
SGT Report
17 hours agoGOD'S ORDER VS. SATAN'S CHAOS -- Dr. Henry Ealy
26.4K35