3️⃣

1.3 Classes

1.3 Classes

Class Syntax

Classes function as templates for other objects. In terms of the Javascript prototype chain, classes essentially help built prototype object(s).
To create new class (called “Student”), use the following code:
class Student { constructor(name, grade) { this.name = name; this.grade = grade; this.marks = []; }
 

Previous Section

Next Section

 
⚖️
Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.