splice()

noun

say it: “SPLYSS” /splaɪs/

A JavaScript array method that removes, replaces or inserts items at any position, changing the original array, and returns the items it removed.

What does splice() do in JavaScript?

splice() — An Array method that removes, replaces, or inserts items by changing the original array.

const tasks = ["Plan", "Deploy"];
tasks.splice(1, 0, "Test");

In a sentence

  • “playlist.splice(1, 1) took the second song out and closed the gap.”

Level: Apprentice · More JavaScript terms at this level

Updated