We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Couldn't load subscription status. Retry
There was an error while loading. Please reload this page.
Keep first n values only.
Alternatives: take, takeRight, takeWhile, takeWhileRight. Similar: take, drop.
function take(x, n) // x: an array // n: number of values [1]
const xarray = require('extra-array'); var x = [1, 2, 3, 4, 5]; xarray.take(x, 2); // → [ 1, 2 ] xarray.take(x, 3); // → [ 1, 2, 3 ]