How do you create an array?


its been long time since i have done them and i can't seem to figure out what it means by "make sure it has at least three elements"


Any code that you have tried to write for this exercise?

I'd suggest to revise the things again. :slight_smile:
Or any confusion you have? you can put here.


well if you want to see my code i haven't done much but here it is: var list = [""]; i t told me to make it var list but i didn't understand the rest


and here is the page address if you need it:


It says to create an array that should consist of 3 items (values/data)

How we create an array?
We set our variable equal to square bracket.

var x = [];

right now x is an empty array. (means it does not have any data/items inside it)

We can put many value when we just define it. (create it)
like this..

var x = [1,2,3,'Hello', true];

x have 5 items.

Note: in this exercise we have to create an array list that have 3 values/items.


tell me if this is what you mean: var list = ["3,2,3,hi, true"]; because this doesn't work


Well if you read instructions, then you will see ..

Create an array called list in the editor. It can contain any data you want! Make sure it has at least three elements.

But the data should be valid.
look at first item of your Array

"3 ? You mean string value 3? "3" ?
also hi , true" . These data are alien to javascript so it throws the error.


thanks for the help i finally got it :slight_smile: :smile:


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