Help w/ Modifying Array Data With Indexes

Help w/ Modifying Array Data With Indexes
0.0 0

#1

I am seriously stuck… any hints?

Here’s the error msg: You should be using correct index to modify the value in myArray.

Your code so far

// Example
var ourArray = [1,2,3];
ourArray[1] = 3; // ourArray now equals [1,3,3].

**Instructions**
Modify the data stored at index 0 of myArray to a value of 3.

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

// Only change code below this line.

ourArray[0] = 3;

Your browser information:

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

Link to the challenge:


#2

You have the right idea, but you’re not working on the correct array.


#3

I found this answer on github: myArray[0] = 3; and it worked.

So it seems that an incorrect amount of spaces is the deciding factor in passing. So weird. I’ll have to do more reading to understand this.

TY!


#4

It’s got nothing to do with the number of spaces, you’ll waste your time trying to read up on that, it’s as @kevcomedia said

the difference between the two, and why your first attempt failed, is that you were changing the array called ourArray but the question wanted you to modify myArray


#5

*facepalm. Thank you!