Tell us what’s happening:
Can anyone explain why this approach doesn’t work? My code meets all the conditions outlined in the challenge. And testing using console.log out confirms that. But it still doesn’t allow me to complete this challenge?
Your code so far
function repeatStringNumTimes(str, num) {
if (num<= 0){ return " "}
else return `${str}${repeatStringNumTimes(str, num - 1)}`;
}
console.log(repeatStringNumTimes("abc", 4))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36
.
Challenge: Repeat a String Repeat a String
Link to the challenge: