Your own types
Read · 1 of 2
Objects and classes
An object groups values under names: const s = { name: "Asha", marks: 91 }; then s.name and s.marks.
A class describes that shape once. Its constructor runs when you write new Student("Asha", 91), and this.name is this student's own name.
1class Student {2 constructor(name, marks) {3 this.name = name;4 this.marks = marks;5 }6}78const s = new Student("Asha", 91);9console.log(s.name, s.marks);