I'm trying to deal with OOP in js
I encountered such a problem. There are 2 classes, one is inherited from another through the prototype class of the parent. The set method is added. When I try to call this method, the successor js says there is no such method.
Example:
function GameObject(){} GameObject.prototype.set = function() {}; function GameFon() {} GameFon.prototype = GameObject; GameFon.prototype.constructor = GameFon; var fon = new GameFon(); fon.set(); //здесь возникает ошибка
What could be the problem?