Infinite loop quesion

Infinite loop quesion
0

#1

Why does the second line create an infinite loop?

for ( i = 0; i < arrLength; i + size) {
    segment = arr.slice(i, i + size + 1);
    newArr.push(segment);
}

Edit: {}


#2

Hard to say without knowing what all the variables mean and what they contain.

Can you provide more code for context?

Also, use the invite button to get specific people to help you, no need to jump into unrelated threads.


#3

I messed up the “i + size” part in the for(). It should read “i += size”. Quite embarrassing mistake, actually. :blush:


#4

I thank you for taking the time to look. :slight_smile:


#5

No worries. So, is it fixed?


#6

Yes, it is. I thank you. Is there a way for me to delete this post or close it somehow so as to not clutter the home page?