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

Learn JavaScript CLASSES in 6 minutes! 🏭
1 year ago
26
Automotive
Education
Programming
Coding
Software Development
Web Development
Mobile App Development
Computer Science
Coding Tutorial
Code Learning
Programming Language
// class = (ES6 feature) provides a more structured and cleaner way to
// work with objects compared to traditional constructor functions
// ex. static keyword, encapsulation, inheritance
class Product{
constructor(name, price){
this.name = name;
this.price = price;
}
displayProduct(){
console.log(`Product: ${this.name}`);
console.log(`Price: $${this.price.toFixed(2)}`);
}
calculateTotal(salesTax){
return this.price + (this.price * salesTax);
}
}
const salesTax = 0.05;
const product1 = new Product("Shirt", 19.99);
const product2 = new Product("Pants", 22.50);
const product3 = new Product("Underwear", 100.00);
product1.displayProduct();
const total = product1.calculateTotal(salesTax);
console.log(`Total price (with tax): $${total.toFixed(2)}`);
Loading comments...
-
1:22:10
Michael Franzese
3 hours agoI'm Calling Out All The Nonsense From The Left & "New" Epstein Files
54K43 -
4:06:45
Grant Cardone
4 hours ago10X Wealth System LIVE: Keep More. Pay Less. Build Faster.
6.71K -
LIVE
TheManaLord Plays
3 hours agoMANA SUMMIT - DAY 1 ($10,200+) | BANNED PLAYER SMASH MELEE INVITATIONAL
236 watching -
2:35:48
I_Came_With_Fire_Podcast
17 hours agoCarolina Bays: The Lost Cataclysm You've Never Heard Of
23.7K8 -
59:56
X22 Report
22 hours agoMr & Mrs X - [DS] Trafficking Empire – The Pedo Network Island, The Cover-Up: Part 2 - Ep 6
103K38 -
1:03:07
Candace Show Podcast
2 days agoI’M BACK! And STILL Asking Questions (Sorry Brigitte). | Candace Ep 233
133K228 -
13:13
Mrgunsngear
21 hours ago $8.03 earnedStreamlight TLR-1 HP Review: Can It Dethrone Surefire?
59.8K20 -
1:26:34
Man in America
1 day agoExposing the Cover-Up That Could Collapse Big Medicine: Parasites
111K134 -
1:12:09
Wendy Bell Radio
10 hours agoPet Talk With The Pet Doc
38.9K52 -
27:15
Liberty Hangout
2 days agoThe Most DELUSIONAL Democrats on Earth!
60K173