How do I add properties to objects in an array?

determine whether the object in the array has an attribute of endTime, and if there is no endTime, add endTime as an empty string

let kingList = res.data.data.kingList
for (let i = 0; i < kingList.length; iPP) {
    if(!kingList[i].endTime) {
        // endTimekingList, 
        kingList[i]["endTime"] = kingList[i]
    }
} 

return data

clipboard.png

Dec.09,2021

arr = arr.map (item = > (item.endTime? Item: Object.assign (item, {endTime:'})


kingList.map(({ endTime , ...other }) => ({ ...other, endTime : endTime || '' }))
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-1ea6ef6-1e15.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-1ea6ef6-1e15.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?