Learn JavaScript CLASSES in 6 minutes! 🏭

  Рет қаралды 31,131

Bro Code

Bro Code

6 ай бұрын

// 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)}`);

Пікірлер: 26
@BroCodez
@BroCodez 7 ай бұрын
// 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)}`);
@sevuszeld5015
@sevuszeld5015 6 ай бұрын
It's not everything you need to know about classes but the very basic. Perfect Video. Thanks for sharing!
@ALLSTARDECOURO2
@ALLSTARDECOURO2 4 ай бұрын
cool, love the way you teach bro. quick easy and direct
@Sijo2
@Sijo2 3 ай бұрын
Thank you for this instructional video. It was very helpful
@mayabakke
@mayabakke 3 күн бұрын
am preparing for my oral IT exam right now THANK YOUU i did NOT pay attention when we learned about this and i need it lol
@surcecode123
@surcecode123 3 ай бұрын
Amazing video
@lilfrostgame7997
@lilfrostgame7997 2 ай бұрын
very helpfull and easy to understand. thank u sirr
@yasinkutlu9105
@yasinkutlu9105 7 ай бұрын
Besttt
@asifahmed6568
@asifahmed6568 4 ай бұрын
Gold dust 🎉❤
@denniswi8628
@denniswi8628 4 ай бұрын
same thing i am doing since years, buti in my new folder structur i cant import the class. How can i import the class ?
@mariamawitmoges4805
@mariamawitmoges4805 Ай бұрын
I love your videos
@Voidlingstudiosofficial
@Voidlingstudiosofficial 27 күн бұрын
f
@neodevils
@neodevils 6 ай бұрын
Hey Bro, I really appreciate your works but I got a question personally; Why don’t you add a whitespace when you open a curly brackets? 😅 It’s always like this: “class Product{}” instead of “class Product {}” Also the comments 4 week ago but the video just published? I didn’t know you had membership for users.
@Evil_E_ye
@Evil_E_ye 6 ай бұрын
That was a pre uploaded video 4 weeks ago i think🤣
@3mk674
@3mk674 2 ай бұрын
hello when react (team) shar an update can u shar a vedios of it
@Voidlingstudiosofficial
@Voidlingstudiosofficial 27 күн бұрын
f
@javidz
@javidz Ай бұрын
ReactJs course please
@LifeOfSamW
@LifeOfSamW 27 күн бұрын
He already made one
@shreehari2589
@shreehari2589 6 ай бұрын
React please 🙃
@bambihollowish
@bambihollowish 4 ай бұрын
Can I get a working account
@cocingtonxhanma7193
@cocingtonxhanma7193 6 ай бұрын
Bro how we can do ddos attack ? In which video ? How we can find the learning of ddos What we need ? Thanks bro
@ALLSTARDECOURO2
@ALLSTARDECOURO2 4 ай бұрын
c'mon bruh
@zixing467
@zixing467 6 ай бұрын
nooooo! not javascript!
@Africanaerial
@Africanaerial Ай бұрын
Skill issue.
@gamerzchoices
@gamerzchoices 4 ай бұрын
Javadcript coping java
@DoNotTrustTheSVN
@DoNotTrustTheSVN Ай бұрын
What the fuck
Learn JavaScript STATIC keyword in 8 minutes! ⚡
8:03
Bro Code
Рет қаралды 10 М.
Build A Calculator With JavaScript Tutorial
38:50
Web Dev Simplified
Рет қаралды 1,5 МЛН
Шокирующая Речь Выпускника 😳📽️@CarrolltonTexas
00:43
Глеб Рандалайнен
Рет қаралды 11 МЛН
格斗裁判暴力执法!#fighting #shorts
00:15
武林之巅
Рет қаралды 98 МЛН
Learn JavaScript ARROW FUNCTIONS in 8 minutes! 🎯
8:02
Bro Code
Рет қаралды 20 М.
6.2: Classes in JavaScript with ES6 - p5.js Tutorial
20:09
The Coding Train
Рет қаралды 399 М.
Learn JavaScript CLOSURES in 10 minutes! 🔒
10:58
Bro Code
Рет қаралды 11 М.
JavaScript ES6 Modules
7:39
Web Dev Simplified
Рет қаралды 441 М.
JavaScript DESTRUCTURING in 8 minutes! 💥
8:41
Bro Code
Рет қаралды 12 М.
Learn JavaScript OBJECTS in 7 minutes! 🧍
7:01
Bro Code
Рет қаралды 36 М.
Javascript Promises vs Async Await EXPLAINED (in 5 minutes)
5:50
Roberts Dev Talk
Рет қаралды 539 М.