Object-prototyping


Hallo,
no 2 salahku dimana ya
terima kasih

name sama school di console.log juga keknya

yang dinyatakan salah di nomor 2 itu karena di soal minta nya panggil data name dan school ke dalam console tapi yang kamu panggil cuma method greeting sama study. Tinggal di tambah aja itu 2 sudah bisa

jadi kira2 codingannya gini
function Student(name, grade, score) {
this.name = name;
this.grade = grade;
this.score = score;
}

Student.prototype.school = “Skilvul”;
Student.prototype.greeting = ()=> "Hello " + this.name;

// Buat kode kamu dibawah ini
Student.prototype.study = function () {
return "I study at " + this.school;
}

let myStudent = new Student(“Sarah”, 20, 100);
console.log(myStudent.name);
console.log(myStudent.school);
console.log(myStudent.greeting());
console.log(myStudent.study());

maaf kalau berantakan