JS: Array.prototype.pop
myArray.pop()
-
- Remove and return the last item.
- If myArray is empty, return undefined.
// example of pop const xx = [3, 4]; const yy = xx.pop(); console.log(yy === 4); console.log(JSON.stringify(xx) === "[3]");
myArray.pop()
// example of pop const xx = [3, 4]; const yy = xx.pop(); console.log(yy === 4); console.log(JSON.stringify(xx) === "[3]");