This problem is from the FreeCodeCamp.com and here’s how I solved it.\n\nQuestion: Repeat a given string (first argument) num times (second argument). Return an empty string if num is not a positive number.\n\nSolution:\n

function repeatStringNumTimes(str, num) {\n  // repeat after me\n  var newName = '';\n  for(x = 0 ; x< num ; x++)\n    {\n      newName += str;\n    }\n  return newName;\n}\n\nrepeatStringNumTimes("abc", 3);\n

\nHappy coding 🙂