We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Remove or replace existing values!
Alternatives: splice, splice$.
function splice$(x, i, n, ...vs) // x: an array (updated!) // i: remove index // n: number of values to remove [rest] // vs: values to insert
const xarray = require('extra-array'); var x = [1, 2, 3, 4, 5]; xarray.splice$(x, 2); // → [ 1, 2 ] x; // → [ 1, 2 ] var x = [1, 2, 3, 4, 5]; xarray.splice$(x, 2, 2); // → [ 1, 2, 5 ] var x = [1, 2, 3, 4, 5]; xarray.splice$(x, 2, 2, 30, 40); // → [ 1, 2, 30, 40, 5 ]