I have for example this object in my firebase database and i push them into an array.
I am just wondering how could i simply sum the “kiszereles” field and count for example the number of times when the “nev” field’s value is “HALDORÁDÓ TOP Method Feeder - Maximum Green”.
I’d probably do something along these lines:
let kisSum = myArray.reduce((sum, item) => sum + item.kiszereles);
//Number of occurrences of nev
let nevOccurrences = myArray.filter(item => item.nev === 'HALDORÁDÓ TOP Method Feeder - Maximum Green').length;
thank you very much! One more question
How could i make more serious filtering? Like counting all the item.nev, sorting them by number of occurences and showing only the top 3