• + 0 comments

    And just because we can, here is a version using reducer:

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