const parent = { parentProp: true, sayHi: () => console.log('Hello') } const child = { greet: () => super.sayHi() } Object.setPrototypeOf(child, parent) child.greet()
Uncaught SyntaxError: 'super' keyword unexpected here
Question:
- As I understand it, the interpreter swears that
super
unacceptable inside the switch functions, but why ? - Is it possible to somehow create a custom solution that replicates the
super
functionality? For example,_super.method()
greet () { super.sayHi()}
solves the problem - Grundy