javascript array remove middle

JavaScript
//Remove specific value by index
array.splice(index, 1);const array = [2, 5, 9];

console.log(array);

const index = array.indexOf(5);
if (index > -1) {
  array.splice(index, 1);
}

// array = [2, 9]
console.log(array); var myArray = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];

//removing element using splice method -- 
//arr.splice(index of the item to be removed, number of elements to be removed)
//Here lets remove Sunday -- index 0 and Monday -- index 1
  myArray.splice(0,2)

//using filter method
let itemToBeRemoved = ["Sunday", "Monday"]
var filteredArray = myArray.filter(item => !itemToBeRemoved.includes(item))const array = [2, 5, 9];

console.log(array);

const index = array.indexOf(5);
if (index > -1) {
  array.splice(index, 1);
}
// array = [2, 9]
console.log(array); var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
newArr.splice(1,2)
//remove 1 element from index 2// example (remove middle element(s) in the array)
let yourArray = ["aaa", "bbb", "ccc", "ddd"];
yourArray.splice(2,1); // yourArray = ["aaa", "bbb", "ddd"]

// syntax:
// <array-name>.splice(<start-index>,<number-of-elements-to-remove>);
Source

Also in JavaScript: