In backbone.js under the inherits method, the authors does this:
var ctor = function() {};
// some other code ...
var child;
// some other code ...
ctor.pro
This is a script that describes the above situation
var x = {
// do nothing
};
var a = function() {};
a.prototype = x;
var b = new a();
console.log("b.__proto__ is x? " + (b.__proto__ == x)); // true
var c = function() {};
c.prototype = new a();
console.log("c prototype.__proto__ is x? " + (c.prototype.__proto__ == x)); // true
var anotherFn = function() {
// do nothing
};
c.prototype.aFn = anotherFn;
var d = new c();
console.log("d __proto__^2 is x?" + (d.__proto__.__proto__ == x)); // true
console.log("d __proto__.aFn is anotherFn? " + (d.__proto__.aFn == anotherFn)); // true