Well itβll always be in bounds, because itβll always be smaller than the number of items in the array. But it wont necessarily be pointing at the right item ;)
Yeah, that stood out to me as well. I would definitely get an exception from doing that unchecked in Kotlin, and Rust might not even let it compile (at least in debug mode).
Also, does items[i + 1] index off the end of the array? does js have an equivalent to rust's "windows", where you get an iterator over like like (0, 1), (1, 2), ... (N-2, N-1), (N-1, N)?
Also is this just iterator invalidation issues?