@extra-array/splice.min

Removes or replaces existing values. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Usage no npm install needed!

<script type="module">
  import extraArraySpliceMin from 'https://cdn.skypack.dev/@extra-array/splice.min';
</script>

README

Removes or replaces existing values. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Alternatives: splice, splice$.

This is part of package extra-array.

This is browserified, minified version of @extra-array/splice.
It is exported as global variable array_splice.
CDN: unpkg, jsDelivr.


array.splice(x, i, [n], ...vs);
// x:  an array
// i:  remove index
// n:  number of values to remove (rest)
// vs: values to insert
const array = require("extra-array");

var x = [1, 2, 3, 4, 5];
array.splice(x, 2);
// [ 1, 2 ]

array.splice(x, 2, 2);
// [ 1, 2, 5 ]

array.splice(x, 2, 2, 30, 40);
// [ 1, 2, 30, 40, 5 ]


References