Sorry if this is a dumb question I'm just experimenting and don't understand why this doesn't work:
var MyFunc = function() {};
MyFunc.prototype = {
receive: function() {
console.log("Received");
},
spine: [MyFunc],
}
var func = new MyFunc();
func.receive(); //works
func.spine[0].receive(); //error: Object function () {} has no method 'receive'
The last line is the error line.
Full output:
Received
/home/zxcv/Documents/CODE/js/stuff/gp/scratch.js:13
func.spine[0].receive(); //error: Object function () {} has no method 'receive
^
TypeError: Object function () {} has no method 'receive'
at Object.<anonymous> (/home/USER/Documents/CODE/js/stuff/gp/scratch.js:13:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:929:3
shell returned 8