Heterogeneous arrays


#1


arrays and objects in JS heterogeneous arrays

says"syntaxError : missing ] after element list"

Replace this line with your code. 
var myArray = [7, true, "hello" Object];


#2

After "hello" word you need to put a comma to separate array items.


#3

Apart from the missing comma, Object is not what you might think. When we declare an object, we write,

new Object()   // constructor

or

{}             // object literal

as in,

... "hello", { name: "object literal" }

#4

thanks so much, helped a ton!


#5

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