Skip to content

Instantly share code, notes, and snippets.

@tkssharma
Last active September 6, 2017 07:26
Show Gist options
  • Save tkssharma/5f00acfd977ef5ad9366f9e7861fc5d1 to your computer and use it in GitHub Desktop.
Save tkssharma/5f00acfd977ef5ad9366f9e7861fc5d1 to your computer and use it in GitHub Desktop.
function shape(){
}
shape.prototype.sayhello = function(){}
function newShape(){
}
// copy prototype
newShape.prototype = shape.prototype;
newShape.prototype.constructor = newShape
//-----------------------------------------//
function shape(){
}
shape.prototype.sayhello = function(){}
function newShape(){
}
// augmentig prototype
newShape.prototype = new Shape();
newShape.prototype.constructor = newShape
//-------------------------------------------//
function NEW(O){
function F(){}
F.prototype = O.prototype;
return new f();
}
var obj1= {}
var obj2 = NEW(obj1);
//-----------------------------------------//
var F = function () {};
F.prototype = TwoDShape.prototype;
Triangle.prototype = new F();
Triangle.prototype.constructor = Triangle;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment