Last active
September 6, 2017 07:26
-
-
Save tkssharma/5f00acfd977ef5ad9366f9e7861fc5d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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