Answers for "remove from end of array javascript"

282

array remove element js

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
0

Remove an item from the end of an Array

let last = fruits.pop() // remove Orange (from the end)
// ["Apple", "Banana"]
Posted by: Guest on July-02-2021

Code answers related to "remove from end of array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language