Arrays

Arrays in Internet Object

An array is represented using the pair of square brackets surrounding zero or more values. Each value is separated by commas. The array starts with an open square bracket ([ U+005B) and ends with a close square bracket (] U+005D).

An Array Walkthrough

A string array.

[one, two, three]

An object array.

[{ a, b, c }, {j, k, l}, { x, y, z }]

An array with mixed values.

[one, T, { a:10, b: -Inf, NaN } ]

Multi-dimensional Arrays

A Two-dimensional array represents rows and columns.

# Two-dimentional Array
[[1, 1, 1], [1, 1, 1], [1, 1, 1]]

A three-dimensional array is a multidimensional array that represents a collection of two-dimensional arrays.

# Three-dimentionali Array
[
   [[10,20,30],[40,50,60],[70,80,90]], # elements of block 1   
   [[11,22,33],[44,55,66],[77,88,99]], # elements of block 2
   [[12,23,34],[45,56,67],[78,89,90]]  # elements of block 3
 ]

Last updated