Run to execute this JavaScript code for real (output appears here).
Ready.
Reverses an array in place with two pointers: swap the outermost pair, move both pointers inward, and stop when they meet. Press Run (Ctrl + Enter) to animate, or Step forward (F10) to go one event at a time.
Step
1 / 17
Line (JavaScript)
—
main (no active function frames)
No counted operations yet.
[1, 2, 3, 4, 5, 6]