unshift Summary Adds the specified element to the beginning of the array. Signatures Click on a signature to select it and view its documentation. public int unshift(T elements) public int unshift(...T elements) Usage public int unshift(T elements) public int unshift(...T elements) Returns The size of the array after the new element was added. The size of the array after the new element was added. Parameters elements The element to add to the top of the array. Parameters elements The elements to add to the top of the array. Description Adds the specified element to the beginning of the array and returns the size of the modified array. This method mutates the array. Adds elements to the beginning of the array and returns the size of the modified array. This method mutates the array. Examples Basic Usage 123456import System; int[] arr = [ 2, 3, 4 ];Console.log(arr.first()); // 2arr.unshift(1);Console.log(arr.first()); // 1 Basic Usage 123456import System; int[] arr = [ 2, 3, 4 ];Console.log(arr.first()); // 2arr.unshift(0, 1);Console.log(arr.first()); // 0 Share HTML | BBCode | Direct Link