I\'m getting an array returned to me and I need to count the rows that have a value in them
I\'ve tried to call arr.length but that gives me the total length of the
You can use reduce and some like this. This checks for all the keys in the object:
const arr = [{id:'1','':''},{id:'2','':''},{id:'3','':''},{id:'4','':''},{id:'','':''},{id:'','':''},{id:'','':''},{id:'','':''},{id:'','':''},{id:'','':''},{id:'','':''},{id:'','':''},{id:'','':''},{id:'','':''},{id:'','':''},{id:'','':''},{id:'','':''},{id:'','':''},{id:'','':''},{id:'','':''},{id:'','':''}]
const count = arr.reduce((r,a) => Object.values(a).some(v => v) ? ++r: r, 0)
console.log(count)