Basic JavaScript - Access Array Data with Indexes

Tell us what’s happening:

Access Array Data with Indexes

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. Like strings, arrays use zero-based indexing, so the first element in an array has an index of 0.

Example

const array = [50, 60, 70];
console.log(array[0]);
const data = array[1];

The console.log(array[0]) prints 50, and data has the value 60.


Create a variable called myData and set it to equal the first value of myArray using bracket notation.

Severely struggling with Java.

Make it make sense… I don’t know what I am missing. The passed few steps have made no sense to me.
Your code so far

const myArray = [50, 60, 70];
myData = myArray[0];

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Access Array Data with Indexes

Link to the challenge:

Thank you Randell.

I need to SLOW DOWN!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.