Classes Part 1 - Old And New Syntax
محتوى الدرس
main.js
/*
OOP => Classes Part 1
Old and New Class Syntax
*/
class User {
constructor(name, age) {
this.name = name;
this.age = age;
}
getInfo() {
console.log(`Hello ${this.name} Your Age Is ${this.age}`);
}
getDays() {
console.log(`You Lived For ${this.age * 365} Days`);
}
}
const firstUser = new User("Osama", 36);
firstUser.getInfo();
firstUser.getDays();