Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

array unshift()

//The unshift() method adds a new element to an array (at the beginning), and "unshifts" older elements:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.unshift("Lemon");
//The unshift() method returns the new array length : >> 5


/*if you find this answer is useful ,
upvote ⇑⇑ , so  the others can benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)*/
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #array
ADD COMMENT
Topic
Name
9+6 =