According to the documentation, the pop method removes the last element from an array and returns that value to the caller. You can find more information about it here.
However, in the example below:
arr=[1,2,3,4,5];
console.log(arr.pop()); //undefined
This code snippet prints undefined. Do I always need to store the popped values and use them, or is there a workaround?
Update:
I am receiving "undefined" even in the Chrome console. When comparing `arr.pop()` with its return value, it is returning true. The attached image shows this.