Hello i have been experimenting with utilizing the pop function. I know it stores the last value, so if i push the removed value back onto the array i should get the same result. However, I don’t get the same array, in fact I get a number: 5.
Here is my code
const chores = ['wash dishes', 'do laundry', 'take out trash', 'cook dinner', 'mop floor']; const removed = chores.pop(); console.log(chores); console.log(removed); console.log(chores.push(removed));
and here is what I am getting as a result:
[ ‘wash dishes’,
‘take out trash’,
‘mop floor’ ]
[ ‘wash dishes’, ‘do laundry’, ‘take out trash’, ‘cook dinner’ ]