An array element can reference another array for its value. Such arrays are called as multi-dimensional arrays. ES6 supports the concept of multi-dimensional arrays. The simplest form of a multi-dimensional array is a two-dimensional array.
var arr_name = [ [val1,val2,val3],[v1,v2,v3] ]
The following example better explains this concept.
var multi = [[1,2,3],[23,24,25]] console.log(multi) console.log(multi) console.log(multi) console.log(multi) console.log(multi) console.log(multi)
The above example initially declares an array with 2 elements. Each of these elements refer to another array having 3 elements. Following is the pictorial representation of the above array.
While referring to an array element here, the subscript of the initial array element must be followed by the subscript of the referenced array element. This is illustrated in the above code.
The following output is displayed on successful execution of the above code.
1 2 3 23 24 25