Array Visualizer

See how JavaScript arrays work

Get a value by index

To get a value of an array at a specific index, we use square brackets [].

var arr = ['Johnny', 'David', 'Sarah'];

Click one of the below buttons to highlight the value by index

Get a value in a nested array

To get a value of a nested array, we use two square brackets []. The first one accesses values in the parent array, the second one accesses values in the nested array.

var arr = [['Johnny', 'David'], ['Tom', 'Paul']];
[
,
]

Click one of the below buttons to highlight the value by index