.splice() Method
var darkSide = ['Darth Vader', 'Darth Plagueis', 'Emperor Palpatine', 'Count Dooku', 'General Grievous', 'Kylo Ren', 'Darth Maul'];
var removed = darkSide.splice(2, 4, 'Darth Sidious', 'Darth Tyranus');
console.log(darkSide);
console.log(removed);[ 'Darth Vader', 'Darth Plagueis', 'Darth Sidious', 'Darth Tyranus', 'Darth Maul' ]
[ 'Emperor Palpatine', 'Count Dooku', 'General Grievous', 'Kylo Ren' ]Last updated