Counting in JS?

why is it when you are counting in JS for arrays do you always start with 0?

// Example
var ourArray = [1,2,3];
var ourData = ourArray[0]; // equals 1

// Setup
var myArray = [1,2,3];

// Only change code below this line.
var myData = myArray[0];

Because in JavaScript, arrays are zero-indexed. That is just the way it is.

1 Like

ok sounds great I just did not know that. good to know