how to get length of part of array in javascript -
in javascript have array of objects "city". example:
var city = {name:'kortenberg',lat:50.8884334,longcoord:4.5440302,province:'vb',group:'1492683180968819'}; var data = [city]; city = {name:'braine',lat:50.8884334,longcoord:4.5440302,province:'wb',group:'freecycle.brainelalleud'}; data.push(city); to length of array, data.length . possible length of array objects has "wb" province?
data.filter(function (item) { return item.province === 'wb'; }).length has done trick. limelights
Comments
Post a Comment