03-27-2021 17:21
03-27-2021 17:21
I need to iterate through some elements, I'm generating the element id using a couple of loops.
for(let x=0;x<=3;x++){
for(let y=0; y<=30; y++) {
console.log(`${x} ${y}`);
}
}
this seems pretty straight forward, but I notice toward the end I don't see all the output in console.
[11:13:46]2 26
[11:13:46]2 27
[11:13:46]2 28
[11:13:46]2 30
[11:13:46]3 2
[11:13:46]3 5
[11:13:46]3 9
[11:13:46]3 12
that's a snippet, and you can see '2 29' is missing, so is '3 1', and others.
What's causing this?
Answered! Go to the Best Answer.
03-27-2021 17:24
03-27-2021 17:24
I think the debug bridge (or something) silently drops log lines when it gets saturated. This seems to happen at around 30 lines if written in quick succession. You could perhaps test this theory by slowing down the loop, or by printing intermittent lines.
03-27-2021 17:24
03-27-2021 17:24
I think the debug bridge (or something) silently drops log lines when it gets saturated. This seems to happen at around 30 lines if written in quick succession. You could perhaps test this theory by slowing down the loop, or by printing intermittent lines.
03-27-2021 20:40
03-27-2021 20:40
Yes, if I pick specific example, or use modulus, all the iterations are there.
Thank you!
03-27-2021 20:42
03-27-2021 20:42
👍
So your code was fine all along. 🙂