freeCodeCamp Challenge Guide: Access Array Data with Indexes

freeCodeCamp Challenge Guide: Access Array Data with Indexes
0

#1

We can access the data inside arrays using indexes.

Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array.

For example:

var array = [1,2,3];
array[0]; //equals 1
var data = array[1];

Edit*
Actually is asking for you to create an Array of myData but pull information from myArray.

So actually the correct answer would be something like this.

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

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


#2

// 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];