Hi. I’m going through arrays and one specific bit of code confuses me.
const newItemTracker = ['item 0', 'item 1', 'item 2']; const removed = newItemTracker.pop(); console.log(newItemTracker); // Output: [ 'item 0', 'item 1' ] console.log(removed); // Output: item 2
So here is what confuses me. When we create the constant ‘removed’ we set it to newItemTracker.pop(). Shouldn’t this mean that the popped value of newItemTracker only exists within the ‘removed’ constant and does not change the original variable? I hope this makes some sort of sense. Could someone please help?