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

Get values from middle.

Similar: left, middle, right.


function middle(x, i, n)
// x: an iterable
// i: start index
// n: number of values [1]
const xiterable = require('extra-iterable');

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

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


References

Clone this wiki locally