JS11 Class Notes
JS11 Class Notes
Prototypes in JS
A javaScript object is an entity having state and behavior (properties and method).
Those objects will have some state (variables) & some behaviour (functions) inside it.
class MyClass {
constructor( ) { ... }
myMethod( ) { ... }
}
Inheritance in JS
inheritance is passing down properties & methods from parent class to child class.
class Parent {
super.parentMethod( args )
Let‘s Practice
Qs. You are creating a website for your college. Create a class User with 2 properties, name &
email. It also has a method called viewData( ) that allows user to view website data.
Qs. Create a new class called Admin which inherits from User. Add a new method called
editData to Admin that allows it to edit website data.
Error Handling
try-catch
try {