FREE JAVASCRIPT ARRAY TOOL
Slice vs splice.
See what stays.
Same array. One letter apart. Predict what comes back and what gets left behind with this slice-versus-splice visualizer.
slice(start, end) copies a range; the end index is excluded. splice(start, deleteCount, ...items) edits the original and returns the removed elements. Its second argument is a count, not an end index.
2. Predict both values. 3. Reveal the difference.
Original array · before
Indexes start at 0. Each snippet below starts with its own fresh array.
Free, no signup. These are fixed teaching examples, not a code runner. Predictions stay in this page’s memory only; reloading clears them. The examples use strings; slice copies are shallow, not deep copies of nested objects.
PUT YOUR NEXT AHA TO WORK
Try it in a short puzzle
Keep the return value and the original separate as you read.
Method references: MDN slice and MDN splice.
