Write a function printDigitCounts(digits) that prints how many times every digit occurs in an array.
digits is an array of whole numbers from 0 to 9. It can be empty.<digit>: <count>, for example 1: 2.printDigitCounts([1, 0, 0, 1, 3, 5])Prints 1: 2 | 0: 2 | 3: 1 | 5: 1
printDigitCounts([7, 7, 7])Prints 7: 3
Asked at Capgemini · Source
printDigitCounts([ 1, 0, 0, 1, 3, 5 ])1: 2
0: 2
3: 1
5: 1printDigitCounts([ 4, 2, 4 ])4: 2
2: 1Hidden tests run on Submit.