Answers for "how to delete special value from array in javascript"

9

how to delete special value from array in javascript

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 June-15-2020

Code answers related to "how to delete special value from array in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language