Last active
November 30, 2018 08:54
-
-
Save ganeshkbhat/91b67f240a6b8db20e85520672bfa983 to your computer and use it in GitHub Desktop.
Object properties Inheritance
This file contains 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; | |
function splitIntoArray() { | |
arr = someStr.split(''); | |
return arr; | |
} | |
function concatFromArray() { | |
return arr.join(''); | |
} | |
return { | |
splitIntoArray: splitIntoArray, | |
concatFromArray: concatFromArray | |
} | |
} | |
function extendStrFns(someStr) { | |
function splitIntoArrayUsingComa() { | |
return someStr.split(','); | |
} | |
return { | |
splitIntoArrayUsingComa: splitIntoArrayUsingComa | |
} | |
} | |
function extendedStringFns(someStr) { | |
return Object.assign(defaultStrFns(someStr), extendStrFns(someStr)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment