Solely invoking the super keyword in a method throws an error, however when accessing it's properties ex. super.constructor, everything works as expected. Is there a reason or it's just another javascript quirk?
class Foo {
constructor() {
this.bar();
}
bar() {
/*
console.log(super);
throws the following SyntaxError:
Uncaught SyntaxError: invalid use of keyword 'super'
instead of logging the HomeOjbect's (Foo.prototype) prototype (Object.prototype in this case)
*/
console.log(super.constructor);
//here however no problem, it logs Object function
}
}
new Foo