The prototype is inside the cc.__proto__
attribute.
The browser (JS engine) place it there.
The new function looks something like:
function new() {
var newObj = {},
fn = this,
args = arguments,
fnReturn;
// Setup the internal prototype reference
newObj.__proto__ = fn.prototype;
// Run the constructor with the passed arguments
fnReturn = fn.apply(newObj, args);
if (typeof fnReturn === 'object') {
return fnReturn;
}
return newObj;
}
This line is the relevant line for you:
newObj.__proto__ = fn.prototype;
The Object.prototype
The Car.prototype
is the definition of all the methods and properties of the Car object. The cc
instance store it inits __proto__