Day 7 Challenge

Create a function that accepts and array counts the number of times a particular item shows up in the array. Do not ignore capitalization, punctuation, or spaces.

Examples:

    itemCounter(["hello", [["Hello", "hello"], [["Hello"]], "Hello", "world"]], "hello"); // 2

    itemCounter([["A", "A", "A", "A", "A", "a"],
      ["a", "A", "A", "A", "A", "A"],
      ["A", "a", "A", "A", "A", "A"],
      ["A", "A", "A", "a", "A", "A"]], "a"); // 4

    itemCounter([1, 2, [3], [4, 5], [4, [[6, 7], 4]]], 4); // 3
Previous
Previous

Count Item Occurrences in an Array JavaScript Solution

Next
Next

How to Truncate a String in JavaScript