Adding a number to an Array

Tell us what’s happening:
How do I add the number to the array? I have put stuff into the input field and the tests come up fine in all but the number and I end up with errors on how the code is placed but it states that it passes the test?

Your code so far


// Only change code below this line
var myArray = [];

Your browser information:

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

Challenge: Store Multiple Values in one Variable using JavaScript Arrays

Link to the challenge:

nevermind the error part. But it won’t act right if I put in the number

You were supposed to store a string and a number in the array. Have you done that?

yes i have. but it wont read the number

var myArray = ["banana", "apple", "orange", 17]

Hello~!

Here is what the test asks for:

What is the second item in your myArray? :slight_smile:

1 Like

First item has to be a string, second has to be a number.

I got it after looking back over it didn’t think about it at first lol but thank you

1 Like