10/13 loops arrays


#1

My code is:

var junkData = ["Eddie Murphy", 49, "peanuts", 31];
junkData[3];

it prints:31

but the comment is still:
Oops, try again. Alas, you should have printed 31, as that is the 4th element!

what do I do wrong that it does not letting me further? thx in advance for reply.


#2

Hi there,

I think the problem with the above is not so much what you've written, but rather what elements / parts the course expects your code to contain.

If you read the instructions you'll notice that step 2 specifically states the use of console.log()

Print out the fourth element of the array.
1. Start with figuring out how to express what the fourth element in the array is.
2. Then use console.log() to print things out!

Try wrapping your second line junkData[3] in a console.log():
console.log(junkData[3]);


#3

thank you it works :smile:


#9