Created
February 17, 2020 16:04
-
-
Save kkarimi/895bb0c39818c2fbdc80ab4b629854e2 to your computer and use it in GitHub Desktop.
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
const zeros = (i) => { | |
let result = ''; | |
for (var x=0; x<i; x++) { | |
result = result+'0' | |
} | |
return result | |
} | |
const inner = (numZero) => (str) => { | |
if (str === undefined) { | |
return inner(numZero + 1) // should be a function | |
} | |
return `bl${zeros(numZero)}mberg` | |
} | |
const bl = inner(0); | |
console.log(bl('mberg')) // blmberg | |
console.log(bl()('mberg')) // blomberg | |
console.log(bl()()('mberg')) // bloomberg | |
console.log(zeros(2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment