# Determining which value to be popped off

**URL:** <https://forum.freecodecamp.org/t/determining-which-value-to-be-popped-off/162344>\
**Category:** General\
**Created:** [December 5, 2017, 2:01pm UTC](https://forum.freecodecamp.org/t/determining-which-value-to-be-popped-off/162344 "2017-12-05T14:01:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tommicome](https://avatars.discourse-cdn.com/v4/letter/t/97f17d/32.png) [@Tommicome](https://forum.freecodecamp.org/u/Tommicome)\
**Post date:** [December 5, 2017, 2:01pm UTC](https://forum.freecodecamp.org/t/determining-which-value-to-be-popped-off/162344/1 "2017-12-05T14:01:51Z")

</div>

**Tell us what’s happening:**

**Your code so far**

```auto
// Example
var ourArray = [1,2,3];
var removedFromOurArray = ourArray.pop(); 
// removedFromOurArray now equals 3, and ourArray now equals [1,2]

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

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

```

**Your browser information:**

Your Browser User Agent is: `Mozilla/5.0 (X11; CrOS x86_64 9901.77.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.97 Safari/537.36`.

**Link to the challenge:**  
[https://www.freecodecamp.org/challenges/manipulate-arrays-with-pop](https://www.freecodecamp.org/challenges/manipulate-arrays-with-pop)

How do I know which one it is to be popped off?

---

<div class="post-metadata">

**Author:** ![Dereje1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dereje1/32/63598_2.png) [@Dereje1](https://forum.freecodecamp.org/u/Dereje1)\
**Post date:** [December 5, 2017, 2:48pm UTC](https://forum.freecodecamp.org/t/determining-which-value-to-be-popped-off/162344/2 "2017-12-05T14:48:47Z")

</div>

`.pop()` always removes the last element of the array, `.shift()` always removes the first.

---

<div class="post-metadata">

**Author:** ![Tommicome](https://avatars.discourse-cdn.com/v4/letter/t/97f17d/32.png) [@Tommicome](https://forum.freecodecamp.org/u/Tommicome)\
**Post date:** [December 5, 2017, 3:01pm UTC](https://forum.freecodecamp.org/t/determining-which-value-to-be-popped-off/162344/3 "2017-12-05T15:01:26Z")

</div>

Thanks. It was really helpful.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:32pm UTC](https://forum.freecodecamp.org/t/determining-which-value-to-be-popped-off/162344/4 "2021-01-17T20:32:58Z")

</div>

Closed on January 17, 2021, 8:32pm UTC


