Created
September 18, 2015 14:21
-
-
Save ceaksan/ee8f479154e2a164288e 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
function repeat(str, num) { | |
if(num === 0) { return str; } | |
else if(num > 0) { | |
var newStr = ''; | |
var i = 0; | |
while(num > i){ newStr += str; i++; } | |
return newStr; | |
} else { return ''; } | |
} | |
repeat("abc", 3, ""); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment