shrini
July 31, 2020, 12:31pm
1
Tell us what’s happening:
i dont get it but why…
Your code so far
function repeatStringNumTimes(str, num) {
var accumulatedStr = " ";
while ( num > 0) {
accumulatedStr += str;
num--;
}
return accumulatedStr;
}
repeatStringNumTimes("abc", 3);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36
.
Challenge: Repeat a String Repeat a String
Link to the challenge:
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
Hey there @shrini ,
What do you not get? You have to be more specific with what you are having problems with so we can try and help you.
shrini
July 31, 2020, 12:34pm
3
I type the code according to the instruction but still i dint get
snigo
July 31, 2020, 12:38pm
4
It looks like you start with whitespace rather then empty string
1 Like
As @snigo said, you started with a whitespace in your string. What this will do, is add a whitespace at the beginning of every string you return. Here’s what it looks like:
shrini
July 31, 2020, 3:43pm
6
thank you so much i got it correct .