Answers for "remove object from array typescript"

19

typescript remove object from array

const index = myArray.indexOf(key, 0);
if (index > -1) {
   myArray.splice(index, 1);
}
Posted by: Guest on February-27-2020
17

how to take an element out of an array in javascript

var data = [1, 2, 3];

// remove a specific value
// splice(starting index, how many values to remove);
data = data.splice(1, 1);
// data = [1, 3];

// remove last element
data = data.pop();
// data = [1, 2];
Posted by: Guest on November-11-2019
1

typescript remove an item from array

myArray.splice(index, 1); // insert index and then amount to remove 
						  // from that index
Posted by: Guest on October-27-2020

Code answers related to "remove object from array typescript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language