How to use blank lines of js to distinguish data

the screenshot of the data printed by the console is as follows

clipboard.png

  2`4 01,3,5
Oct.04,2021

const arr = [0, 1, null, 3, null, 5];
let result = arr.reduce((res, acc) => {
    if (acc === null) {
        res.push([]);
        return res;
    }

    res[res.length - 1].push(acc)
    return res;
}, [[]])

console.log(result);//[ [ 0, 1 ], [ 3 ], [ 5 ] ]

take a chestnut, the actual situation changes the null value judgment part to the object judgment.
then remind you not to map.


the way you pass the data in this way is inherently wrong. The normal format would look like this:
`

data: [
    {
        year: '2011',
        type: 'type1',
        name: '',
        save: '30'
    }
]

`
then traverse the array according to the type field for classification
in addition, it is true to use Chinese as the key value.

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