//INPUT
var array = [2020, 2021, 2022, 2023];
console.log(array);
var index = array.indexOf(2020);
if (index > -1) {
array.splice(index, 1);
}
// OUTPUT : array = [2021, 2022, 2023]
console.log(array);
Note: Run This Code In Browser Console For Testing
According To Question:
#Remove Specific Element From Array Javascript
#Javascript Remove Object From Array By Value
#Remove Element From Array Jav
#Array Filter
#Splice Javascript
#Jquery Remove Item From Array By Index
#Lodash Remove Item From Array
#Remove Object From Json Array Javascript
No comments:
Post a Comment