getCount(obj)
count the objects with matching internal values
by trentHarlem
JavaScript
// n = 5
let input = [{x:1,y:1},{x:2,y:3},{x:3,y:3},{x:3,y:4},{x:4,y:5},]
function getCount(objects) {
console.log(objects.slice().filter(obj=>obj.x==obj.y).length)
return objects.slice().filter(obj=>obj.x==obj.y).length
}
getCount(input)