Answers for "js arraye remove element by index"

36

javascript remove from array by index

//Remove specific value by index
array.splice(index, 1);
Posted by: Guest on May-06-2020
3

js remove element from array

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);
Posted by: Guest on August-21-2020

Code answers related to "js arraye remove element by index"

Code answers related to "Javascript"

Browse Popular Code Answers by Language