Use the length of the array to set a limit to your counter. Since you start from 0, the counter should never be as big as the array length.

Perfect! What's left is to increase the counter.

Make sure you choose i < arr.length.