myArray.push(["dog",31]); where is wrong?
could you add your codepen here
I don’t see anything wrong there. That should push that two item array onto your array myArr.
Can we see the code? What is happening that you think shouldn’t?
// Only change code below this line. var myArray = [["John",23],["cat",2]]; myArray.push(["dog",31]); // ourArray now equals [["John",23],["cat",2],["dog",31]]
I just cant find out where is wrong
var myArray = [["John",23],["cat",2]]; myArray.push(["dog",31]); // ourArray now equals [["John",23],["cat",2],["dog",31]]
That code works just fine for me. See this pen. (press ctrl-shft-j to open the console.)
The only problem is the curly (smart) quotes but that may be a result of the cut/paste and the forum.
And the variable ourArray? That is part of the example. I’m not sure why that comment is at the end. But I would reset the challenge (“reset your code” on the left) and reenter your line:
on line 9. It works for me. Check back with us if that doesn’t solve your problem.
It is the inverted commas.
writing with your hand is much better than copying.
As Kevin said it is a copying problem
I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (
</>) will also add backticks around text.
OP’s posts were written with straight quotation marks, not curly ones, so that’s probably not the issue.
@sandy1: have you checked if your variable name matches the one the challenge requires? Is it testing
I make mistake 3 to 31,thank you guys!