Skip to content

Instantly share code, notes, and snippets.

Created December 5, 2015 18:16
Show Gist options
  • Save anonymous/26946105f59db973d837 to your computer and use it in GitHub Desktop.
Save anonymous/26946105f59db973d837 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/bskydive 's solution for Bonfire: Repeat a string repeat a string
// Bonfire: Repeat a string repeat a string
// Author: @bskydive
// 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
return num<=0?'':str.repeat(num);
}
repeat("abc", 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment