Sort by

recency

|

387 Discussions

|

  • + 0 comments
    function getCount(objects) {
        let count = 0;
        for (const {x, y} of objects) {
            if (x === y) count++;
        }
        return count;
    }
    
  • + 0 comments

    function getCount(objects) { var counter = 0; objects.forEach(function(object){ if (object.x==object.y){ counter++; } }); return counter; }

  • + 0 comments
    function getCount(objects) {
        let counter = 0;
        objects.forEach((obj) =>{ 
            if (obj.x === obj.y)
                counter++;
        });
        return counter;
    }
    
  • + 0 comments
    function getCount(objects) {
      let count=0,i;
      for(i=0; i<objects.length; i++){
        if(objects[i].x==objects[i].y){
            count++;
        }
      }
      return count;
    }
    
  • + 0 comments
    function getCount(objects) {
        return objects.filter((item)=> item.x === item.y).length;
    }