-
Notifications
You must be signed in to change notification settings - Fork 5
dropRight
Subhajit Sahu edited this page Jun 20, 2020
·
12 revisions
Discards last n values only. 🏃 📼 📦 🌔 📒
Alternatives: [drop], [dropRight], [dropWhile], [dropWhileRight].
Similar: [take], [drop].
array.dropRight(x, [n]);
// x: an array
// n: number of values (1)
const array = require('extra-array');
var x = [1, 2, 3, 4, 5];
array.dropRight(x, 2);
// [ 1, 2, 3 ]
array.dropRight(x, 3);
// [ 1, 2 ]