-
Notifications
You must be signed in to change notification settings - Fork 1
takeRight
Subhajit Sahu edited this page Feb 3, 2021
·
12 revisions
Keep last n values only.
Alternatives: take, takeRight, takeWhile, takeWhileRight.
Similar: take, drop.
function takeRight(x, n)
// x: an iterable
// n: number of values [1]
const xiterable = require('extra-iterable');
var x = [1, 2, 3, 4, 5];
[...xiterable.takeRight(x, 2)];
// → [4, 5]
[...xiterable.takeRight(x, 3)];
// → [3, 4, 5]