InterviewSolution
Saved Bookmarks
| 1. |
Which keyword can be used to deploy inheritance in ES6? |
|
Answer» The extend keyword is used to implement inheritance in the ES6 language. There was no idea of classes in prior VERSIONS of Javascript, but with the release of ES6, Pure OBJECT ORIENTED ELEMENTS were added to the language. class Classroom { constructor(students) { this.students = students; } room() { console.log('This class has ' + this.students + ' students'); }} class sectionA extends Classroom { constructor(students) { super(students); } sec() { console.log('section A'); }} LET secA = new sectionA(40); secA.room();secA.sec(); |
|