How to count occurrences of strings in array of arrays?

I have the following array of arrays (pasted below) and would like to loop through it to count how many times each color appears. What’s the simplest way to go about doing this?

[
["Brown"],
["Blue", "Green"],
["Red", "Black", "White", "Other"],
["Green"],
["Green", "Gold"],
["Blue"]
];

76 thoughts on “How to count occurrences of strings in array of arrays?”

  1. i need easy loan, i need a loan now with poor credit. i need 2 lakhs loan i need loan need a loan been refused everywhere i need a loan have bad credit, cash advance loans online bad credit, cash advance loans, cash advance online, cash advance loans contact number. Money management study of those financial affairs, designed for companies.

    Reply

Leave a Comment