0
0 Comments

I have an The array javascript splice() method changes the contents of an array by removing
existing elements and/or adding new elements.
Here is my code.

var months = ['Sun', 'Mon', 'Tue', 'Wed'];
months.splice(1, 0, 'Mon');
// inserts at 1st index position
console.log(months);
// expected output: Array ['Sun', 'Mon', 'Tue', 'Wed']
 months.splice(4, 1, 'Fri');
// replaces 1 element at 4th index
console.log(months);
// expected output: Array ['Sun', 'Mon', 'Tue', 'Fri']


How Can i change the multiple value in javascript array

Answered question
Add a Comment