Store Multiple Values in one Variable using JavaScript Arrays lesson - problem

Tell us what’s happening:
The challenge/lesson is saying that I have to put a string in the first item/element
And put a number in the second item/element, all that in the myArray variable even though I think that’s what I did?

Your code so far


// Only change code below this line
var myArray = ["Say it again" + 1];

Your browser information:

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

Challenge: Store Multiple Values in one Variable using JavaScript Arrays

Link to the challenge:

Hi @MAZ1211 !

If you want to seperate multiple elements in an array you will need to do so by placing commas between them.

Let’s look at the FCC example

var sandwich = ["peanut butter", "jelly", "bread"]

You can’t use + signs here

This is incorrect

You don’t have to concaternate. You should use a comma instead not a ‘+’

I didn’t even pay attention that I should’ve put a comma instead of a plus sign. Well, you live and learn as they say I guess.
Thanks!

1 Like

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