Now there is an attribute in the array. I want to delete this line of attributes when the value of this attribute is true, but how to delete all of them when there are multiple tru? now just delete one.

current array

    let arr = [
        {id:1,Itemtype:true,name:""},
        {id:2,Itemtype:false,name:""},
        {id:3,Itemtype:true,name:""},
        {id:4,Itemtype:false,name:""},
        {id:5,Itemtype:false,name:""},
        {id:6,Itemtype:true,name:""},
    ]
    

then I make a copy of this array

    var copy = [];
     for (var item in arr) {
            copy[item] = arr[item];
     }
         for(var i=0;i<copy.length;iPP){
                if(copy[i].Itemtype == true){
                    arrCopy.splice(i,1)//splicei,1true
                }
            }
            log(copy);

only one has been deleted, but how do I delete all the attributes whose value is true?

Oct.14,2021

arr.filter(({Itemtype})=>!Itemtype)

var copy = [];
 for (var item in arr) {
    if(!item.Itemtype){
        copy[item] = arr[item];
    }
 }

isn't this copy the deleted array?


just use filter, and the new array is returned.
arrCopy.splice (iPower1) this will change the length of the array, and there will be problems in the for loop


arr.filter ((item) = >! item.Itemtype)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3302f-2b6b0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3302f-2b6b0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?