How to change the array object to the one I want to split with','

clipboard.png

Nov.24,2021

function fn(arr, key) {
    var obj = {};
    arr.forEach(item => {
        if (item[key] != null) {
            obj[key] ? obj[key].push(item[key]) : obj[key] = [item[key]];
        }
    })
    return obj[key] && obj[key].toString();
}

fn(arr, 'id')

if es6 is supported, this interface is convenient
arr.map (item = > item.id) .join (',')

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-7c38df-2aae6.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-7c38df-2aae6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?