I’m trying to define functions on a object within a prototype like in this example:
function Particle = {
this.calculate.x = 0;
}
Particle.prototype.calculate.calculateX = function() {
//do calculation
}
var particle - new Particle();
If I explore particle in the browser console the ‘calculate’ object is visible but without any of the functions defined on it.
What am I missing?
Is it even possible to define an object prototype in this way?
Cheers!
Try this way: