skip to Main Content

Jquery – Count elements and show/update value of current in view + total

I am trying to understand how to count and display current and total number of figures on my page. My html <div class="is-vertical"> <figure><img src="src.jpg"><figcaption class="wp-element-caption">Towers Day<br>NYC</figcaption></figure> <figure><img src="src.jpg"><figcaption class="wp-element-caption">Towers Day<br>NYC</figcaption></figure> <figure><img src="src.jpg"><figcaption class="wp-element-caption">Towers Day<br>NYC</figcaption></figure> </div> My js attempt of…

VIEW QUESTION

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