Array creation problem

Tell us what’s happening:
Describe your issue in detail here.
I am asked to create an array “yourArray” that contains 5 elements .Now the problem is do i have to put all of those things in an object

Your code so far
myArray = [1, true, “john”]


let yourArray; // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36

Challenge: Use an Array to Store a Collection of Data

Link to the challenge:

Hi @ahmadminam22 !

Welcome to the forum!

You don’t need to include an object in your array if you don’t want to.

As long as you have a number, boolean and string the other two data types are up to you.

Also, making sure your are creating your array here

and not adding an extra line of code like this

You need to declare myArray. So you will need to use let or const.
For example

let exampleArray = [1,  {name:  'tom',  age: 24}, false, 5]

You cannot just do

exampleArray =  [1,  {name:  'tom',  age: 24}, false, 5]

You will get an error as example array is not defined.

I don’t think the OP needs to create myArray at all.
The challenge has already provided them with an array

let yourArray; // Change this line

There is not need to create another one. :grinning:

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