Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript Change the Elements of an Array

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

// this will add the new element 'exercise' at the 2 index
dailyActivities[2] = 'exercise';

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