Answers for "remove element on array js"

282

javascript array remove element

var colors = ["red","blue","car","green"];
var carIndex = colors.indexOf("car");//get  "car" index
//remove car from the colors array
colors.splice(carIndex, 1); // colors = ["red","blue","green"]
Posted by: Guest on July-19-2019
3

how to remove item from array javascript

var array = ["Item", "Item", "Delete me!", "Item"]

array.splice(2,1) // array is now ["Item","Item","Item"]
Posted by: Guest on February-01-2020
1

js remove element from array

let arrDeletedItems = array.splice(start[, deleteCount[, item1[, item2[, ...]]]])
Posted by: Guest on December-03-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language