pop Summary Removes the last element of the array. Usage public T+ pop() Returns The last element of the array that was removed or undefined if there were no elements left in the array. Description Removes the last element of the array and returns the element. If there are no elements in the array, undefined is returned. This method mutates the array. Examples Basic Usage 123456import System; int[] arr = [ 1, 2, 3, 5 ];Console.log(arr.last()); // 5arr.pop(); // Removes last elementConsole.log(arr.last()); // 3 Return and remove the last element of the array 123456import System; int[] arr = [ 1, 2, 3, 4, 500, 600, 700, 800 ];Console.log(arr.length); // 8Console.log(arr.pop()); // 800Console.log(arr.length); // 7 Share HTML | BBCode | Direct Link