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							
						
														27						
								
								
												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:02:27 1:02:27VINCE2 hours agoA Very Trump Halloween | Episode 159 - 10/31/25108K39
- 	
				 LIVE LIVEBadlands Media10 hours agoBadlands Daily: October 31, 20254,001 watching
- 	
				 1:34:28 1:34:28Graham Allen3 hours agoSCARY: Kamala Had MELT DOWN Over Trump!! Does LSU Hate Charlie Kirk?! + Top Halloween Movies Of ALL TIME!!73.8K37
- 	
				 LIVE LIVECaleb Hammer1 hour agoShe Blames MAGA For Her Debt | Financial Audit235 watching
- 	
				 LIVE LIVEThe Big Mig™3 hours agoWhat To Give The Man Who Has EVERYTHING!5,142 watching
- 	
				 1:32:16 1:32:16Benny Johnson2 hours agoSHOCK: Massive Food Stamp FRAUD Exposed: 59% of Welfare are Obese Illegal Aliens!? Americans RAGE…22K39
- 	
				 LIVE LIVEWendy Bell Radio7 hours agoAmerica Deserves Better6,196 watching
- 	
				 22:01 22:01DEADBUGsays2 hours agoDEADBUG'S SE7EN DEADLY HALLOWEENS14.6K5
- 	
				 LIVE LIVETotal Horse Channel13 hours ago2025 IRCHA Derby & Horse Show - October 31st41 watching
- 	
				 1:10:29 1:10:29Chad Prather15 hours agoStanding Holy in a Hostile World54.5K29