Sort by

recency

|

390 Discussions

|

  • + 0 comments

    return objects.filter(obj => obj.x === obj.y).length;

  • + 1 comment

    function getCount(objects) { let count = 0;

    objects.forEach((item)=> {
        if (item.x === item.y) count++ 
    })
    return count;
    

    }

  • + 0 comments

    function getCount(objects) { return objects.reduce( (acc, cur) => acc + (cur.x == cur.y), 0);
    }

  • + 0 comments
    function getCount(objects) {
        let count = 0;
        objects.map((o)=> o.x == o.y ? count++ : count)
        return count;
    }
    
  • + 0 comments
    function getCount(objects) {
        let count = 0;
        for (const {x, y} of objects) {
            if (x === y) count++;
        }
        return count;
    }