'JavaScript Super.prop in object literals

let proto = {
    whoami() { console.log('I am proto'); } 
};
let obj = { 
    whoami() { 
        Object.getPrototypeOf( obj ).whoami.call( this ); // super.whoami();
        console.log('I am obj'); 
    } 
};
Object.setPrototypeOf( obj, proto );

This code lets obj inherit the proto. I got confused about this code Object.getPrototypeOf( obj ).whoami.call( this ); which is equvalent to super.whoami(). Can anyone explain how this code works?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source