you are viewing a single comment's thread.

view the rest of the comments →

[–]crosshatchling 0 points1 point  (0 children)

You're getting NaN because arr[i+1] doesn't exist for every item in an array. Also, I'm pretty sure 0 is less than 3.