skip to Main Content

Javascript – Iterate through an object and count all strings containing specific text within each and all arrays

I have an object containing arrays, I want to count the number of occurrences a particular string is found across all arrays in the object. const festivals = { 'Danny': ['Glastonbury','Glastonbury','Leeds','Leeds','Leeds','Benicassim','MadCool'], 'Jimbo': ['Glastonbury','Glastonbury','Leeds','Leeds','Leeds','Leeds','Benicassim','MadCool'], 'Richard': ['Glastonbury','Leeds','Leeds','Benicassim','MadCool'], 'John': ['Glastonbury','Leeds'] } let totalFestivals…

VIEW QUESTION
Back To Top
Search