Code: Select all
var array = [2, 5, 9, 8];
Code: Select all
array.remove(item);
Code: Select all
var array = [2, 5, 9, 8];
Code: Select all
array.remove(item);
Code: Select all
var array = [2, 5, 9, 8];
var index = array.indexOf(5);
if (index > -1) {
array.splice(index, 1);
}
console.log(array); // [2, 9, 8]
Code: Select all
var rValue = 'three'
var arrayItems = ['one', 'two', 'three', 'four', 'five', 'six']
arrayItems = arrayItems.filter(item => item !== rValue)
console.log(arrayItems)
Code: Select all
[ 'one', 'two', 'four', 'five', 'six' ]
Code: Select all
let forDeletion = ['two', 'three', 'four']
var arrayItems = ['one', 'two', 'three', 'four', 'five', 'five' , 'six']
arrayItems = arrayItems.filter(item => !forDeletion.includes(item))
console.log(arrayItems)
Code: Select all
[ 'one', 'five', 'six' ]