How do I preview my code or answer?

Tell us what’s happening:
Describe your issue in detail here.

When I go through exercises and submit my answer, how can I view my answer? I see when it’s correct with a window popping up, but how can I see the code?

Your code so far

// Setup
const myArray = [["John", 23], ["cat", 2]];

// Only change code below this line
const removedFromMyArray = myArray.pop();

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Manipulate Arrays With pop()

Link to the challenge:

Are you looking for console.log? If you’re looking to come back at your code, you can save it locally: ctrl + s

1 Like

Sorry, I may not be asking it correctly, but how can I see the output of a function like .pop()

I may be missing it, but the only feedback I get to submitting my answer is the pop-up window to move on to the next question. I’d like to see why it’s correct.

// Setup
const myArray = [["John", 23], ["cat", 2]];

// Only change code below this line
console.log(myArray) // logs the array without pop
const removedFromMyArray = myArray.pop();
console.log(myArray) // logs the new array after pop
console.log(removedFromMyArray) // logs the removed element
1 Like

I’m not sure I understand what type of feedback you are asking for?

The tests can’t tell you why your code is correct, they can only check against expected values and code and pass or fail depending on your code. They can’t tell you why the code is correct.

1 Like

Thank you. I appreciate you showing that.

Thanks for clarifying that it’ll pass or fail depending on code. I understand.

I believe you are looking for


the importance and uses for console.log() cant be overstated lol
if you are looking just to see your answer every time before you finally submit, I recommend removing the return statement of the function replace with


then when you are finally done and ready to fully submit your answer, delete the console.log() and replace with

return whateverYourFunctionIsGoingToReturn;

I dunno if this helps or not lol but i think thats what you were trying to see

1 Like

Just as an aside, when you log the result of calling a method it is important that you understand what the method returns.

Check the MDN docs on the method and look at the return section.


Thank you. Yes, this helps. :raised_hands:

Thanks for reminding me to refer to the MDN docs – great resource. :grinning:

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