I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
Is this the first time that myArray is declared? If so, then having it on the right of the assignment operator doesn’t make sense. If myArray already exists, then you are redeclaring, which is invalid syntax.
You didn’t link to the correct challenge.
Also please go to your challenge and read the task again. You are calling .pop() twice but according to your explanation, you want it to do two different things with each call → so that can’t work.
Also given how .pop() actually works, you propably only need to call it once.
1- Your array is declared is a const. Therefore, you cannot redeclare it. To pop it, you simply:
myArray.pop();
2- If you do that, you will remove the last nested array, leaving your original array with nothing but john, 23.
3- That means that when you create a removedFromArray and pop it again… the only thing
it has available to pop is john,23 because you already popped the cat before.
So you are technically popping TWICE.