Last active
October 17, 2016 18:58
-
-
Save halcarleton/0cb305ab804e8159b86ecf8b2448ad02 to your computer and use it in GitHub Desktop.
Revisions
-
halcarleton revised this gist
Oct 17, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -19,8 +19,8 @@ function SubOne(p1) { delete this.y.a; }; SubOne.prototype = Object.create(Base.prototype); SubOne.prototype.constructor = SubOne; /** * new Base(2, 3) == { -
halcarleton revised this gist
Oct 17, 2016 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ // Base Class function Base(p1, p2) { this.x = this.someMethod(p1, p2); this.y = { @@ -12,6 +13,7 @@ Base.prototype.someMethod = funciotn(a, b) { /*************/ // SubClass that inherits from Base function SubOne(p1) { Base.call(this, 10, p1); delete this.y.a; -
halcarleton created this gist
Jun 20, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ function Base(p1, p2) { this.x = this.someMethod(p1, p2); this.y = { a: p1, b: p2 }; } Base.prototype.someMethod = funciotn(a, b) { return a + b; }; /*************/ function SubOne(p1) { Base.call(this, 10, p1); delete this.y.a; }; SubOne.prototype = new Base(); SubOne.constructor = SubOne; /** * new Base(2, 3) == { * someMethod: Base.prototype.someMethod, * x: 5, * y: { * a: 2, * b: 3 * } * } * * new SubOne(8) == { * someMethod: Base.prototype.someMethod, * x: 80, * y: { * b: 8 * } * } */