super keyword
by Artem
JavaScript
'use strict';
const parent = {
parentProp: true,
sayHi() {
console.log('Hello')
}
};
const child = {
greet() {
super.sayHi()
}
};
Object.setPrototypeOf(child, parent);
child.greet();
by Artem
'use strict';
const parent = {
parentProp: true,
sayHi() {
console.log('Hello')
}
};
const child = {
greet() {
super.sayHi()
}
};
Object.setPrototypeOf(child, parent);
child.greet();