// The splice() method can be used to add new items to an array:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.splice(2, 0, "Lemon", "Kiwi");
// >> ["Banana", "Orange", "Lemon", "Kiwi", "Apple", "Mango"]
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
let arr = [1,2,3]
// delete elements:
arr.splice(/*starting index*/, /*number of elements to delete*/)
// delete and replace elements:
arr.splice(/*starting index*/, /*number of elements to delete*/, /* value(s) to replace what was deleted */)