Group items by common

    0

    0

    Ken Malley

    const groupedItems = items.reduce((results,item) => { if (item.id === 0) { results.push(item); } else { results[item.id] = [] for (var i = 0; i < items.length; i++) { results[item.id].

    const groupedItems = items.reduce((results,item) => {
        (results[item.id] = results[item.id] || []).push(item);
        return results;
    }, {})
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.