According to ES6 shorthand initialiser, following 2 methods are same:
var person = {
name: \"Person\",
greet: function() {
return \
So, why do we get error?
Because super
is only valid inside methods. greet: function() {}
is a "normal" property/function, not a method, because it doesn't follow the method syntax.
The differences between a method and a normal function definition are:
super
.new
.