Kelas dalam JavaScript
class Students {
name;
address;
schoolName = "Morning Sun School";
constructor(name,address,fatherName){
this.name = name;
this.address = address;
this.fatherName = fatherName;
}
}
const olivia = new Students("Olivia", "USA","James");
const emma = new Students("Emma", "UK", "alex");
console.log(olivia);
console.log(emma);
// Output of Olivia
Students {
name: 'Olivia',
address: 'USA',
schoolName: 'Morning Sun School',
fatherName: 'James'
}
// Output of Emma
Students {
name: 'Emma',
address: 'UK',
schoolName: 'Morning Sun School',
fatherName: 'alex'
}
Ariful Islam Adil(Code Lover)