About the deleted array of js

var array = [
    {
        id:1,
        name:""
    },
    {
        id:2,
        name:""
    },
    {
        id:3,
        name:""
    }
];
array.splice(0,1);
array.splice(1,1);
console.log(array);

"" spliceN

change the function
this is obviously a search / filter operation

array.filter((item)=>item.name==="")

Array.prototype.splice.apply(array,[0,1],1);

can you first extract Xiao Hong into an array, then empty the original number, and then assign the new array to the original


array = [array [1]] the easiest


use the filter function

array.filter(item => item.id === 2)

look at your description, which means "I need a filter".


var array1 = array.slice (1) can bring out Xiao Hong

Menu