Created
October 4, 2015 02:36
-
-
Save waltzaround/de7fed2da9a1bad855e1 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) { // we need a string and the number of times to repeat it to run our function | |
var contain = ""; // we create a new variable named contain | |
for(var repeat = 0; repeat < num; repeat++){ | |
// we create a new variable called repeat | |
//as long as repeat is greater than the quantity of num, add 1 to repeat and run the code in the for statement | |
contain += str; //assuming top holds true, we add contain to str | |
} | |
return contain; // we then send contain out of the function | |
} | |
repeat("abc", 3, ""); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment