-
Notifications
You must be signed in to change notification settings - Fork 1
slice
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 (-ve: from right) (0)
// I: end index (-ve: from right) (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 ]