FAQ: Arrays - The .pop() Method


This community-built FAQ covers the “The .pop() Method” exercise from the lesson “Arrays”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Introduction To JavaScript

FAQs on the exercise The .pop() Method

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!


Why does the example for using the .pop() method (page 8 of 12) include code that is not used in lesson?

“const removed = newItemTracker.pop();” is used in the example, with the reasoning that this variable can be used later. However, if this code is used in the instruction, the answer is marked as wrong and we are told to only use the name of the function followed by .pop(). “Gotcha” inconsistencies between the lesson and the instructions cause needless delays in learning, and confusion.


The instructions are different from the example for good reason… To see if you gleaned the right information from the lesson.

We are given an array of strings with the name chores.

We see from the example that the last item in the array will be removed if we write,


except with the array name in place of Array.

What’s more, we can preserve that value just by assigning it to another variable.

temp = Array.pop()

If we do not assign the value, it will be gone. That’s what should happen in the exercise. Just pop() and then log chores to see that the last value is indeed gone.

I don’t see any inconsistency with the this lesson, the example or the instructions. Follow them to the letter.



Thank you for the response; Again, the lesson indicated a variable could be saved by using the const “removed”.


Not to contradict what the lesson is suggesting, we should consider whether we plan to re-use a variable or assign different values during our session. If so, then use let, not const.

Consider a loop where we are manipulating an array using pop() but we want to examine and use the values as they come off the list.

let list = "JavaScript".split('');
revList = [];
let temp;
while (list.length > 0) {
  temp = list.pop();
  if (temp === temp.toUpperCase()) {
    temp = temp.toLowerCase();
  } else {
    temp = temp.toUpperCase();
["T", "P", "I", "R", "C", "s", "A", "V", "A", "j"]

Contrast with simply reversing a list…

let list = "JavaScript".split('');
revList = [];
while (list.length > 0) {
  revList.push(list.pop());    // value still preserved in new array
["t", "p", "i", "r", "c", "S", "a", "v", "a", "J"]