01 / 12
What is going on inside that array you pushed to
You have surely written const a = [] in JavaScript and called a.push(10) over and over. Where were those values being put?
An array takes a run of space in memory. Put 10 down and 20 goes right beside it, then 30 beside that. Laid out with no gaps: that is an array.
Being laid out in a run buys one nice thing: say which position you want and the location falls out of a calculation. Add "index times the size of one element" to the location of the first. So a[500] and a[0] come back equally fast. That is what straight there by index means.
array[10][20][30][40] 0 1 2 3a[2] is found by calculation