Skip to content

allLocalIndexesOf

SuperPhantomUser edited this page Jun 10, 2021 · 2 revisions

AllLocalIndexesOf

The allLocalIndexesOf method returns an array with all the local indexes of an item found
Note: a local index of an item is the index of that item in the deepest array it's in

Array types: 2d+
Returns: array

Arguments:

  • array
  • item

Examples:

const array = [
	["a", "b", "c", "b"],
	["e", "f", "b", "h"]
];
console.log(Arrays.allLocalIndexesOf(array, "b"));
// Returns: [1, 3, 2]
const array = [
	[
		["a", "b", "c", "a"],
		["e", "f", "g", "h"]
	],
	[
		["i", "a", "k", "l"],
		["m", "a", "o", "p"]
	]
];
console.log(Arrays.allLocalIndexesOf(array, "a"));
// Returns: [0, 3, 1, 1]

Clone this wiki locally