Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Since an array can hold any valid JavaScript value, an array can contain other arrays. When this is done, the array containing encapsulated arrays is considered a multidimensional array. Accessing encapsulated arrays is done by bracket chaining. Below, we create an array literal that contains an array, inside of which we create another array literal, inside of which we create another array literal, containing a string value at the 0 index.
<!DOCTYPE html><html lang="en"><body><script> var myArray = [[[['4th dimension']]]]; console.log(myArray[0][0][0][0]); // logs '4th dimension' </script></body></html>
The code above is rather silly, but you can take away the fact that arrays can contain other arrays and you can access encapsulated arrays indefinitely.