Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to add variables to an array in javascript

function addNewArray(newArr){
   newArr.push("Dominic");
   return newArr;
}
//calling a function
addNewArray(newArr["My", "is" ])//Output:["My", "is", "Dominic"]
 
PREVIOUS NEXT
Tagged: #add #variables #array #javascript
ADD COMMENT
Topic
Name
7+3 =