Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript unshift

 let array = ["A", "B"];
 let variable = "what you want to add";

//Add the variable to the beginning of the array
 array.unshift(variable);

//===========================
 console.log(array);
//output =>
//["what you want to add" ,"A", "B"]
Source by alligator.io #
 
PREVIOUS NEXT
Tagged: #javascript #unshift
ADD COMMENT
Topic
Name
3+4 =