Can any body explain these codes to me! Can't understand!


#1

This codes work corrects.But Please explain it to me.
var junkData = ["Eddie Murphy", 49, "peanuts", 31];
var elementFour = 3
var theData = junkData[elementFour];
console.log( theData );


#2

junkData is an array and arrays start at zero so "Eddie Murphy" would be zero and 31 would be 3
you then made elementFour hold the value 3
you then set theData to the third position of junkData since elementFour is 3
you then logged to the console whatever was in theData which was the third position of junData which was 31


#3

thank you @textslayer05918 for helping me