Array Positions


#1

I have the code below listed, the call is showing a result of 31 being printed, but it continues to tell me Oops, try again. Alas, you should have printed 31, as that is the 4th element!.

var junkData = ["Eddie Murphy", 49, "peanuts", 31];
console.log = (junkData[3]);


#2

you don't need = sign for console.log.

after changing it refresh your browser :slight_smile:


#3

Hi , I also have a problem i ahve done this

var junkData = ["Eddie Murphy", 49, "peanuts", 31];
junkData = [0,1,2,3];
console.log(junkData[3]);

and i got number 3, not 31? is that correct or I dont know where i am making mistake


#4

It is because you replaced the elements of junkData.

junkData = [0,1,2,3];

why did you create this?now the first element of junkData is 0 not "Eddie Murphy"


#5

I have nnotice that, you are right. tnx...now is ok...


#6

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