Hey! So im working on this problem but not sure what’s wrong. The console.log statement is actually giving what I am expecting. I know it is an array but I am converting to a string with .join() method. Can some one point me to the right direction or explain why it is Im failing?
Your code so far
function repeatStringNumTimes(str, num) {
let answer = []
for(let i = 0; i < num; i++){
answer.push(str)
}
let result = answer.join("")
console.log(result)
return str;
}
repeatStringNumTimes("abc", 3);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
Challenge: Basic Algorithm Scripting - Repeat a String Repeat a String
Link to the challenge: