Count the hashtags
Given a feed of posts with hashtags, count how often each tag is used, the way a trending list or a tag cloud does.
Write countTags(posts). Each post is an object with a user and an array of tags. Return an object that maps each tag to how many times it was used across all the posts. Tags are counted in lower case, so "Gaming" and "gaming" are the same tag.
JavaScript
countTags([
{ user: "zara_x", tags: ["gaming", "speedrun"] },
{ user: "kofi99", tags: ["Gaming", "lofi"] },
]);
// { gaming: 2, speedrun: 1, lofi: 1 }Checks
- Count every tag
- Any capitals count as the same tag
exercise_1.js to run
function countTags(posts) {
}