Tell us what’s happening:
What is wrong with this code ? I see in the console, it is returning the required output.
Your code so far
function repeatStringNumTimes(str, num) {
// repeat after me
if (num < 0) {
console.log("");
}
else {
var strArr = [];
for (var i=1; i<=num; i++) {
strArr.push(str);
}
return console.log(strArr.join(''));
}
}
repeatStringNumTimes("abc", 3);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string