Sunday, November 25, 2012

JavaScript Instance Diagram

For JavaScript code:

var obj = {};


[Note: __proto__ is available on Chrome and Firefox]

For JavaScript code:

function Rect(w, h)
{
    this.width = w;
    this.height = h;
}
Rect.prototype.area = function() {
    return this.width * this.height;
}
var rect = new Rect(2,4);


[Note: __proto__ is available on Chrome and Firefox]