Last active
November 30, 2018 08:53
-
-
Save ganeshkbhat/c1f5f908c758616cca9a23efcd99c70d to your computer and use it in GitHub Desktop.
Object properties Inheritance using prescribed method
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 DefaultStrFns(someStr) { | |
let arr; | |
this.splitIntoArray = function() { | |
arr = someStr.split(''); | |
return arr; | |
} | |
this.concatFromArray = function() { | |
return arr.join(''); | |
} | |
} | |
function ExtendStrFns(someStr) { | |
defaultStrFns.call(this, someStr); | |
this.splitIntoArrayUsingComa = function() { | |
return someStr.split(','); | |
} | |
} | |
function extendedStringFns(someStr) { | |
return new ExtendStrFns(someStr); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment