Javascript Array Remove Element by value

Description

Javascript Array Remove Element by value



let animals = new Array("dog","cat","seal","walrus","lion", "cat");

// remove the element from array
animals.splice(animals.indexOf("walrus"),1); // dog,cat,seal,lion,cat

console.log(animals);/* ww  w  .  ja  v  a  2 s  . co  m*/



PreviousNext

Related