10/13


#1

// Practice array!

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


#2

You will have to modify
-1
var junkDate[0] = ["Eddie Murphy"]
into
junkData[0] = ["Eddie Murphy"];

AND
console.log = junkData[3]
intp
console.log( junkdata );

AND
do a refresh Browser if have run the program
as the condole.log() method has to be recovered...

AND
you only use the var keyword once...


#3

thanks, i switched out my code and now it still don't work.

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


#4

ok, I changed it up a bit and it still dosn't work
var junkData = ["Eddie Murphy", 49, "peanuts", 31];
junkData[1]=["Eddie Murphy"]
junkData[2]=["49"]
junkData[3]=["peanuts"]
junkData[4]=["31"]
console.log (junkData[4]);


#5

@dusty_chief,
Use following code

var junkData = ["Eddie Murphy", 49, "peanuts", 31];
// do NOT reassign the junkData-Array-Element's, just use them !!!
//var junkDate[0] = ["Eddie Murphy"]
// junkData[1] = [49]
// junkData[2] = ["peanuts"]
// junkData[3] = [31]
console.log(junkData[3]);


#6

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


#7

thanks everyone, this really helps me in my studies


#8

There are many ways t oright this code! Here are a couple!

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

console.log(junkData[3]);

You can also use thise :

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

Both of these work!


#9

OR

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

#10

This code works!

// Practice array!

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


#11
var junkData = ["Eddie Murphy", 49, "peanuts", 31];
junkData[0]="Eddie Murphy"
junkData[1]=49
junkData[2]="peanuts"
junkData[3]=31

The first line does the same as the following 4 lines so either use

var junkData = [];
junkData[0]="Eddie Murphy"
junkData[1]=49
junkData[2]="peanuts"
junkData[3]=31

or just

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

both at the same time is a bit too much.