Tell us what’s happening:
when I run the specified arguments through sublime text I get the results that the challenge is looking for. Yet when I run in codecamp some challenges will not pass. Since the arguments (‘abc’, 3) results in a correct solution, then shouldn’t the arguments (’*’, 8), logically also work? What am I missing?
Your code so far
<spoiler>
let i=0;
let newStr = '';
function repeatStringNumTimes(str, num) {
if(num>0){
while(i<num){
newStr += str;
i++;
}
return newStr;
}else{
return '';
}
}
repeatStringNumTimes("abc", 3);
</spoiler>
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) 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/