Premium Only Content

The JavaScript SUPER keyword is super! 🦸♂️
00:00:00 intro
00:00:22 setup
00:02:39 super constructor
00:05:59 super methods
00:09:03 conclusion
// super = keyword is used in classes to call the constructor or
// access the properties and methods of a parent (superclass)
// this = this object
// super = the parent
class Animal{
constructor(name, age){
this.name = name;
this.age = age;
}
move(speed){
console.log(`The ${this.name} moves at a speed of ${speed}mph`);
}
}
class Rabbit extends Animal{
constructor(name, age, runSpeed){
super(name, age);
this.runSpeed = runSpeed;
}
run(){
console.log(`This ${this.name} can run`);
super.move(this.runSpeed);
}
}
class Fish extends Animal{
constructor(name, age, swimSpeed){
super(name, age);
this.swimSpeed = swimSpeed;
}
swim(){
console.log(`This ${this.name} can swim`);
super.move(this.swimSpeed);
}
}
class Hawk extends Animal{
constructor(name, age, flySpeed){
super(name, age);
this.flySpeed = flySpeed;
}
fly(){
console.log(`This ${this.name} can fly`);
super.move(this.flySpeed);
}
}
const rabbit = new Rabbit("rabbit", 1, 25);
const fish = new Fish("fish", 2, 12);
const hawk = new Hawk("hawk", 3, 50);
rabbit.run();
fish.swim();
hawk.fly();
-
1:56:44
MG Show
23 hours agoEpstein, Comey, Brennan: It’s ALL Connected; Pandora’s Box Premium
43.9K27 -
3:43:36
megimu32
14 hours agoOFF THE SUBJECT: FAFO Friday w/ Pepkilla
93.4K13 -
2:16:11
I_Came_With_Fire_Podcast
18 hours agoCCP INFLUENCE IN U.S. | DOXXING ICE AGENTS | PAY YOUR OWN LOAN
63K18 -
15:30
BlackBeltBarrister
19 hours ago $12.17 earnedThey will screw us all with this!!
76.9K42 -
2:04:22
TimcastIRL
14 hours agoDan Bongino AND Kash Patel THREATEN TO QUIT FBI Over Botched Epstein Release | Timcast IRL
335K335 -
5:10:31
Turning Point USA
18 hours agoSAS IS LIVE! Pete Hegseth, Don Jr., Tucker Carlson, Charlie Kirk and more... in Tampa, FL!
1.06M106 -
1:54:35
Glenn Greenwald
20 hours agoUN Gaza Investigator Francesca Albanese on US Sanctions Against Her; Plus: Glenn Takes Your Questions on Trump's Pressure on Brazil, Sam Harris, Bill Ackman, and More | SYSTEM UPDATE #485
116K66 -
58:37
BonginoReport
1 day agoElon’s Petty Move Threatens GOP’s Bright Future - Nightly Scroll w/ Hayley Caronia (Ep.88)
130K140 -
24:53
Preston Stewart
19 hours ago $4.69 earnedTrump Arms Ukraine
93.1K61 -
1:00:00
BEK TV
1 day agoDRONES IN AMERICA: DJI'S MARKET DOMINANCE, FUTURE USES, AND A REAL LOOK AT THE MEASLES OUTBREAK
59.5K7