Modify Array Data With Indexes Problem

Tell us what’s happening:
i cant figure out what i’m doing wrong, the code is correct but apparently something is wrong with the index !? Can somebody help me?

Your code so far

// Example
var ourArray = [18,64,99];
ourArray[1] = 45; // ourArray now equals [18,45,99].

// Setup
var myArray = [18,64,99];

// Only change code below this line.
var myArray = [45,64,99];

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.

Link to the challenge:

the challenge hint says…
Modify the data stored at index 0 of myArray to a value of 45 .
you need something like the example…

ourArray[0] = 15;
1 Like
myArray[0] = 45;  // try with without adding any space between myArray and [0]

//myArray should now be [45,64,99].
1 Like

Try this,

unset($foo[0]); // remove item at index 0
$foo2 = array_values($foo); // 'reindex' array

I hope this will help you…
Thank you

1 Like

Isn’t that a bit too complex for someone just starting out?

1 Like

i got it now guys! Thank U!!