June 2016
Intermediate to advanced
910 pages
18h 59m
English
The super keyword can also be used in the concise methods of the object literals. The super keyword in concise methods of the object literals, has the same value as the [[prototype]] property of the object defined by the object literal.
In the object literals, super is used to access the over-ridden properties by the child object.
Here is an example to demonstrate how to use super in object literals:
var obj1 = {
print(){
console.log("Hello");
}
}
var obj2 = {
print(){
super.print();
}
}
Object.setPrototypeOf(obj2, obj1);
obj2.print(); //Output "Hello"
Read now
Unlock full access