Tell us what’s happening:
hello!!!
could someone please help me understand what I am doing wrong and how to fix my problem with the
correct index
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.
correct index in myArray = [45,64,99];
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15.
// 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 ourArray = [18,64,99];
ourArray[0] = 45;
Okay so what we need to do is: Modify the data stored at index 0 of myArray to a value of 45 .
so 1st thing we set a variable and call it myArray and set it up like we ussualy do adding a = and a ; Then we need to input the numbers 45 64 and 99 we get those if we put just the 45 in the string alone.
var ourArray = [50,40,30];
just like in the above example they give us we start with bracets and end with them no spaces.
var myArray = [45,64,99];
now comes the second part again where we do use zero-indexing
> ourArray[0] = 15; // equals [15,40,30]
as we can see in the example above we don’t need to put a var before myArray only bracets and the standart set up we used before the first number is 0 cause again 0-indexing then 45 because thats what they asked us to do