Skip to content

Instantly share code, notes, and snippets.

@DStereo
Last active May 4, 2016 09:01
Show Gist options
  • Save DStereo/40c1c6a09b3533059947839c8921f97c to your computer and use it in GitHub Desktop.
Save DStereo/40c1c6a09b3533059947839c8921f97c to your computer and use it in GitHub Desktop.
Repeat string in functional manner
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