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']
 
PREVIOUS NEXT
Tagged: #JavaScript #Add #Element #Array
ADD COMMENT
Topic
Name
7+6 =