class Person {
constructor(name, age) {
this.name = name
this.age = age
}
greet() {
console.log(`Hello, ${this.name}`)
}
}
let p = new Person("Jake", 20)
console.log(p)
p.greet()
class Employee extends Person {
constructor(name, age, role) {
super(name, age)
this.role = role
}
}
let e = new Employee("James", 25, "Clerk")
console.log(e)
e.greet()
To embed this project on your website, copy the following code and paste it into your website's HTML: