0
Hey guys how can i check how many li is same in html using js
<li>abcd</li> <li>efgh</li> <li>abcd</li> The output should be like abcd=2 , efgh=1
5 odpowiedzi
+ 2
Is same in what way dude? same in its content, its style?. Elaborate more on that "is same" in the Description please ...
(Edit)
We can use an empty object to contain frequency counters
https://code.sololearn.com/WVtxBbJ3i9rF/?ref=app
+ 1
You could do something like this
1. create an dictionary with a string as key and a int as value
2. save the list(from html) into a variable
3. go through the list
4. check if the item is in your dictionary if not add it to it
else increase the value by one
5. print the dictionary
+ 1
Big Thanks Mǟɖ↻ôɖɆⱤ💉 bro 🙏