Created
December 8, 2015 01:48
-
-
Save anonymous/cbfc608931fefeaedac4 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/kkas 's solution for Bonfire: Repeat a string repeat a string
This file contains hidden or 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
// Bonfire: Repeat a string repeat a string | |
// Author: @kkas | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-repeat-a-string-repeat-a-string# | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function repeat(str, num) { | |
// repeat after me | |
if (num < 0) { | |
return ""; | |
} | |
return str.repeat(num); | |
} | |
repeat("abc", 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment