slice and Spread Copies
Take a window of items, or copy an array without mutating the original.
slice(start, end) returns a new array (end not included).
[...arr] also makes a shallow copy. Editing the copy should leave
the original list alone.
Original
Result / copy
Important JavaScript
const names = ["Ava", "Ben", "Cara", "Drew"];
const page = names.slice(1, 3);
// ["Ben", "Cara"] — original unchanged
const copy = [...names];
copy[0] = "Alex";
// names still starts with "Ava"
// copy starts with "Alex"
// Shallow copy: nested objects inside are still shared references.