14/17 Heterogeneous Arrays


When i submit my code it keeps on telling me that my code needs atleast four elements even though i'm pretty sure i have four.... Here is my code:

var myObj = {
type: true,
disposition: 'sunny' ,
name: "James" ,
age: 44,

myArray = [myObj];


var myObj = new Object();

myArray = [23,true, "Haris",myObj];


try do boolean = true


The four elements must be inside the array, not the object, like this:

var myArray = [17, true, "JavaScript", myObj];


It doesn't work for me, I wrote it just like @maxtirdatov did (with my own values and declared the object). It keeps telling me the fourth element should be an object.

 var obj=new Object();
obj.adj="cool"; obj.me="awesome";
var newArray=[13, false, "Nuci", obj];


nevermind, I put the array name wrong.


uziman398, a couple of issues. The task wants an array with four values. Even though you created an object with four values, there is only one value in your array - the object. The task also requested the values to be in a certain order (number, boolean, string, object). The below works:

var myArray = [23, true, "Pete", (obj1 = new Object())];


What they want is:
a newArray = [[array1], [array2,].,...[object added from outside]]

so, create an object with this and put it inside newArray:

var myObj = {
state: "JB",
country: "Malaysia",
age: "60"

My script:
newArray = [[1,2,2,2],["Hong","JB"],[myObj]]



This worked fine for me:

var myArray = [2, true, "Tom", myObj];
//var bool1 = true;
var myObj = new Object("type", "age", "gender");
type: "Human";
age: 57;
gender: "male";


how do you like this one
var myArray = [1,true,"as",{number: "one"}]