Syntax of "myArr[i] " explained?

Tell us what’s happening:

Hi ya’ll! I got the correct answer to propagate, but I’d really like to understand the logical relationship in " ourArr[i] " What I mean is, where is that syntax explained? I get what the code is doing, but I don’t understand why it is written that way. Where can I read about square brackets being used this way?

Thank you!

Your code so far

// Example
var ourArr = [ 9, 10, 11, 12];
var ourTotal = 0;

for (var i = 0; i < ourArr.length; i++) { 
  ourTotal += ourArr[i];

var myArr = [ 2, 3, 4, 5, 6];
var total =0;
for (var i = 0; i < myArr.length; i++){
  total += myArr[i];

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36 OPR/49.0.2725.64.

Link to the challenge:

It’s in Javascript Basics. See Access Array Data With Indexes. It refers to the lessons about strings, also in Javascript Basics. There are a few, the first one is Use Bracket Notation to Find the First Character in a String.

While you’re at it you can check out Modify Array Data With Indexes.

Thanks, this was helpful.

I also found a section in Chapter 4 of Eloquent Javascript which I feel explains it all a bit more clearly.