Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript Add an Element to an Array

let dailyActivities = ['eat', 'sleep'];

// add an element at the end
dailyActivities.push('exercise');

console.log(dailyActivities); //  ['eat', 'sleep', 'exercise']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #JavaScript #Add #Element #Array
ADD COMMENT
Topic
Name
4+5 =