Make sure you have at least four elements in myArray


#1

var myArray
var bool1 = true;
var myObj = {
type: 'fancy',
disposition: 'sunny'

myArray = [72], [bool1], ["My life"], [myObj]
code

Instructions
Create an array, myArray. Its first element should be a number, its second should be a boolean, its third should be a string, and its fourth should be... an object! You can add as many elements of any type as you like after these first four.


#3

What task number is this again?


#4
  1. Heterogenous Arrays

#5

Your just suppose to create a hetezeragus array like this....

var myArray = [1 , true , "HEy" , 3.4]

#6

OK then, whats wrong with my info
that is what is wrong


#7

You forgot to close your bracket.....


#8

ok, i will try that but i dont know


#9

I mean @codeace40947 if i where to code like your way this is one result.

var myArray
var bool1 = true;
var bool2 = false;
var myObj = {
        type: 'fancy',
        disposition: 'sunny'
}
myArray = [72, bool1, myObj["type"], bool2]

#10

Still doesnt work @amanuel2 its failed


#11

you copy pasted my code and it failed? If it did what browser are you using.


#12

chrome browser
it is the only one i use


#13

Only solution i have for you is try this...:

myArray = [72,true,"Hello", false]

#14

When i did that it said
Is the fourth element of myArray an object?


#15

Sorry i forgot to put var, try this:

var myArray = [72,true,"Hello", false]

#16

@amanuel2 That didnt help at all


#17

Wow then i dont know what to do... Try refreshing your browser? Restarting your browser? I will call on some other moderators for help.

@albionsrefuge


#18

ok, i will try both of those


#19

arrays look like this: [ value1, value2, etc ]

You have written 4 tiny arrays with commas between each.

Do you see the problem now?


#20

No, i dont actually because i am starting i am new to this


#21

@albionsrefuge
Here is my code
var myArray
var bool1 = true;
var bool2 = false;
var myObj = {
type: 'fancy',
disposition: 'sunny'
}
var myArray = [72,true,"Hello", false]