slice()

A method that returns a selected portion without changing the original array or string.

What does slice() do in JavaScript?

slice() — A method that returns a selected portion without changing the original array or string.

const tasks = ["Plan", "Build", "Test"];
const selectedTasks = tasks.slice(1);

Level: Apprentice · More JavaScript terms at this level

Updated