Last active
May 4, 2016 09:01
-
-
Save DStereo/40c1c6a09b3533059947839c8921f97c to your computer and use it in GitHub Desktop.
Repeat string in functional manner
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 repeatString(originalString, times) { | |
if (typeof times !== 'number') { | |
return originalString; | |
} | |
return Array(times + 1).join(originalString); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment