Skip to content
Subhajit Sahu edited this page May 10, 2020 · 23 revisions

Gets part of an iterable. 🏃 📼 📦 🌔

iterable.slice(x, [i], [I]);
// x: an iterable
// i: start index (0)
// I: end index (end)
const iterable = require('extra-iterable');

var x = [1, 2, 3, 4, 5];
[...iterable.slice(x, 2)];
// [3, 4, 5]

[...iterable.slice(x, 2, 4)];
// [3, 4]

references

Clone this wiki locally