Tell us what’s happening:
Describe your issue in detail here.
when i run the the following code, it brings out an incomplete message in the output box.
const myArray =[[“john”,23] , [cat, 2]];
removeFromMyArray = myArray.pop();
console.log(myArray);
console.log(removeFromMyArray) Your code so far
// Setup
const myArray = [["John", 23], ["cat", 2]];
// Only change code below this line
const removeFromMyArray = myArray.pop();
console.log(myArray);
console.log(removeFromMyArray);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Challenge: Basic JavaScript - Manipulate Arrays With pop Method
To display code in your post, put three back tics ` before and after the code block. If you cant find a back tic on your keyboard use ALT+096 to display one.
line 1)
not sure what your using around “jonh”. I replaced it with single quotes 'jonh'
add quotes around 'cat'
line 2) removeFromMyArray was not defigned. I added let
once I made these changes, I was able to see the console logs being output
const myArray =[['john',23] , ['cat', 2]];
let removeFromMyArray = myArray.pop();
In second line of your code you have create it const (variable), and change your const to removedFromMyArray
just change it to const removedFromMyArray