Exercise: Count digits
- Given an array of digits, count how many times each digit appears.
let digits = [1, 2, 1, 3, 4, 5, 6, 7, 8, 8, 4, 3, 9, 7, 8, 5, 2, 3, 3, 2, 2, 4, 2, 4, 2, 1];
0: 0 1: 3 2: 6 3: 4 4: 4 5: 2 6: 1 7: 2 8: 3 9: 1
let digits = [1, 2, 1, 3, 4, 5, 6, 7, 8, 8, 4, 3, 9, 7, 8, 5, 2, 3, 3, 2, 2, 4, 2, 4, 2, 1];
0: 0 1: 3 2: 6 3: 4 4: 4 5: 2 6: 1 7: 2 8: 3 9: 1