+ 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

13th May 2020, 4:19 PM
Dilyorbek Valijonov (drdilyor)
Dilyorbek Valijonov (drdilyor) - avatar
2 Answers
+ 3
https://javascript.info/class-inheritance#methods-are-not-free i found some information about super and as ODLNT says i should use run()
13th May 2020, 6:43 PM
Dilyorbek Valijonov (drdilyor)
Dilyorbek Valijonov (drdilyor) - avatar