Skip to content
Subhajit Sahu edited this page May 3, 2023 · 15 revisions

Discard first n values only.

Alternatives: drop, dropRight, dropWhile, dropWhileRight.
Similar: take, drop.


function drop(x, n)
// x: an array
// n: number of values [1]
const xarray = require('extra-array');

var x = [1, 2, 3, 4, 5];
xarray.drop(x, 2);
// → [ 3, 4, 5 ]

xarray.drop(x, 3);
// → [ 4, 5 ]


References

Clone this wiki locally