Access Array Data with Indexes--

Tell us what’s happening:
Describe your issue in detail here.
I sense there is something I am missing because this code came off another forum entry.

Your code so far


var myArray = [50,60,70];
var 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/99.0.4844.51 Safari/537.36 Edg/99.0.1150.30

Challenge: Access Array Data with Indexes

Link to the challenge:

Hi, @justjared! Welcome to the forum. Can you explain what you don’t understand about the challenge?

It won’t allow me to move on to the next course when I press ‘Run the Tests’ with my given code.

What errors are you getting? What have tried to fix those errors?

The challenges are updated every so often, so copying old answers often doesn’t work.

The error messages:

The variable myData should equal the first value of myArray .

The data in variable myArray should be accessed using bracket notation.

with the code listed above.

Originally the array was declared with const. var is a legacy feature. Have you tried going back to using const?

Yes, I just did and to no avail the problem persist. When I checked the other forum entries for answers: var myData = myArray[0]; – worked. idk what is the case here.

Like I said, the challenges receive updates, so it is normal for old answers to not work.

What code, exactly, did you try with const?

I think it might have been a browser issue. I switched browsers and it worked. …so right code, faulty browser. Thank you all who responded.

I’m glad it worked!

In the future, I’d avoid replacing code that is already provided with old versions that you find on the forum. That can lead to some frustrating bugs.