Skip to content
Subhajit Sahu edited this page Feb 3, 2021 · 18 revisions

Get values from right.

Similar: left, middle, right.


function right(x, n)
// x: an iterable
// n: number of values
const xiterable = require('extra-iterable');

var x = [1, 2, 3];
[...xiterable.right(x, 1)];
// → [3]

[...xiterable.right(x, 2)];
// → [2, 3]


References

Clone this wiki locally