const array = [ {id: 12, name: 'toto'}, {id: 12, name: 'toto'}, {id: 42, name: 'tutu'}, {id: 12, name: 'toto'}, ]; const id = 12; const count = array.filter((obj) => obj.id === id).length; console.log(count);