14. Heterogeneous arrays HELP PLEASE


#1

It keep repeats "Make sure you have at least four elements in myArray" when I have four of them! Also, the result screen is reflecting weird...

first, this is my code:

var myArray = [5, false, "Lynn", juice];
var juice = {};
var juice = {
taste: 'Sweet',
color: 'Red'
};
myArray = [juice];

and the screen shows:

[{"taste":"Sweet","color":"Red"}]

I don't know what is wrong and why the result screen is showing that things!


#2

This line is attempting to access a variable that is not yet defined. It will raise an exception.

That line is not needed.

Move this to above the first line so juice is defined.

Remove this line since it is overwriting your orginal array.


#3

Thank you so much!! Now I know what is wrong XD


#4

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