Intern — Middle
Determining the frequency of numbers in an array
livecode
Task condition
The task requires implementing a function that takes an array of integers and returns an object where each key is a number from the array, and the corresponding value is how many times it appears.
function getFrequency(input) {}
console.log(getFrequency([1, 2, 2, 3, 3, J])); // { 1: 1, 2: 2, 3: 3 }
The function should correctly handle any set of numbers and generate a report object about their occurrences.