Answers for "how-can-i-remove-a-specific-item-from-an-array"

0

how-can-i-remove-a-specific-item-from-an-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); 
 Run code snippet
Posted by: Guest on October-16-2021

Code answers related to "how-can-i-remove-a-specific-item-from-an-array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language