21 Day Coding Challenge

Challenge #18 I don't get what it's missing

#1

function sendBroadcast() {
for (i = 0; i <= 100; i++) {
broadcast();
}
}
sendBroadcast();

#2

You’re most likely off by one. I believe your loop runs 101 times. (I always struggle with those) But let’s say…

for (i = 0; i <= 2; i++) {
  broadcast();
}

So it runs at i = 0, i = 1 and i = 2… So… It ran 3 times :frowning:

1 Like
#3

Your problem will be solved if you either start i from 1 or change the condition to i<100. Hope it helped.

2 Likes