Js array processing

  1. the array is as follows
[
{"admin":0,"del":6,"download":0,"move":16,"rename":0,"upload":0},
{"admin":0,"del":0,"download":2,"move":16,"rename":0,"upload":4},
{"admin":0,"del":0,"download":2,"move":16,"rename":0,"upload":0}
]

process the array, in the object of each item, for example, return true, if admin is all greater than 0, otherwise return false

["admin":false,"del":false,"download":false,"move":true,"rename":false,"upload":false
]

is there a good way to deal with

Thank you.

Nov.17,2021

var a = [
{'admin':0,'del':6,'download':0,'move':'16','rename':0,'upload':0},
{'admin':0,'del':0,'download':2,'move':'16','rename':0,'upload':4},
{'admin':0,'del':0,'download':2,'move':'16','rename':0,'upload':0}
],
result = {'admin':true,'del':true,'download':true,'move':true,'rename':true,'upload':true}

var falseRes = a.reduce((sum = {}, item) => {
    var keys = Object.keys(item)
    let temp = {}
    keys.forEach((key) => {
        if (item[key] <= 0) {
            temp[key] = false
        }
    })
    console.log('temp', temp)
    Object.assign(sum, temp)
    return sum
},{})

Object.assign(result, falseRes)


every()

const arr=[
{'admin':0,'del':6,'download':0,'move':16,'rename':0,'upload':0},
{'admin':0,'del':0,'download':2,'move':16,'rename':0,'upload':4},
{'admin':0,'del':0,'download':2,'move':16,'rename':0,'upload':0}
]

const result=arr.every(item=>item.admin>0) //result 
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-1e487b2-271f6.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-1e487b2-271f6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?