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
16
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...
-
2:14:24
Badlands Media
1 day agoDevolution Power Hour Ep. 341: Narrative Cracks, Vaccine Backpedals & The Awakening of the Silent Majority
139K81 -
37:55
Forrest Galante
9 hours agoPrivate Tour of The World's Best Backyard Reptile Zoo
29.5K12 -
14:38
Exploring With Nug
1 day ago $30.95 earnedWe Found the Secret That This Lake Has Been Hiding For Decades!
92.7K11 -
9:20:53
SpartanTheDogg
17 hours agoPro Halo Player
37.2K3 -
23:23
MYLUNCHBREAK CHANNEL PAGE
1 day agoAustralia Was Found
89.4K81 -
1:41:45
The Connect: With Johnny Mitchell
18 hours ago $17.13 earnedMexican Cartels Are Moving MORE Drugs Than Ever, Going To WAR On The Government (Emergency Update)
53.3K10 -
6:54:01
MissesMaam
14 hours agoFinishin' Red Dead Redemption 💚✨
84.5K8 -
34:44
LFA TV
5 days agoMIRACLES DO HAPPEN!
90.8K1 -
5:26:31
GamersErr0r
9 hours ago $5.24 earnedMooning My Community
53.2K1 -
2:22:59
Banks Atkin Live
12 hours agoChilling playing Games & Vibin
76.3K1