Creating a function call frequency and passing an array. I'm taking the values that are in the array which are integers and storing them inside of an object and my end goal is to check the occurrence of every number that has been seen and if they been seen I will increase the count. Why are the property are set as strings?, how can I access the integers to increase the count. I want to increase my understanding of objects.
function frequency(array) {
let object = {}
let count = 0
let num
let temp = []
for (var i = 0; i < array.length; i++) {
num = array[i]
object[num] = count++
console.log(object);
}
}
console.log(frequency([1, 2, 3, 4]));