Skip to content

indexRange

Subhajit Sahu edited this page Feb 2, 2021 · 18 revisions

Gets index range of part of array. 🏃 📼 📦 🌔 📒

Similar: index, indexRange, size, isEmpty.


array.indexRange(x, [i], [I]);
// x: an array
// i: start index (-ve: from right) (0)
// I: end index (-ve: from right) (X)
// --> [start index, end index]
const array = require("extra-array");

var x = [2, 4, 6, 8];
array.indexRange(x, 1);
// [1, 4]

array.indexRange(x, 1, -1);
// [1, 3]

array.indexRange(x, 1, -10);
// [1, 1]


References

Clone this wiki locally