Skip to content

getDimension

SuperPhantomUser edited this page Jun 11, 2021 · 1 revision

GetDimension

The getDimension method returns the dimension of the array.

Array types: 1d+
Returns: integer

Arguments:

  • array

Examples:

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

Clone this wiki locally