+ 1
Super isn't working JavaScript
var animal = { run: function(name="Animal") { alert(name +" is running!"); } } var dog = { __proto__: animal, run: function() { super.run("Dog"); } } super keyword is unexpected here. I don't know what isproblem
2 Answers
+ 7
The problem is run:function() should be run()
https://code.sololearn.com/WXwnyi41G96A/#html
_proto_ is deprecated MDN
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto
Super MDN reference
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/super
+ 3
https://javascript.info/class-inheritance#methods-are-not-free
i found some information about super and as ODLNT says i should use run()