splice methodf code example

Example 1: splice method js

let myFish = ['angel', 'clown', 'mandarin', 'sturgeon']
//insert new element into array at index 2
let removed = myFish.splice(2, 0, 'drum')

// myFish is ["angel", "clown", "drum", "mandarin", "sturgeon"] 
// removed is [], no elements removed

Example 2: what is splice method in javascript

Check Out my CODE-PEN for this Solution 

https://codepen.io/siddhyaOP/pen/eYgRGOe
https://codepen.io/siddhyaOP/pen/eYgRGOe
https://codepen.io/siddhyaOP/pen/eYgRGOe