I'm trying to figure out how to create an object that describes the frequency of certain names in an array. Uppercase or lowercase letters shouldn't matter. Right now each property of the object has the value of 1. I don't know where to go from here.
function getNameFrequency (source) {
const lowerCaseNames = source.map(name => name.toLowerCase())
let frequencyObject = {}
for (const key of lowerCaseNames) {
frequencyObject[key] = 1
}
return frequencyObject
}
console.log(getNameFrequency[Anne, LUKE, luke, simon, Daniel, anne])
// expected output => { anne: 2, luke: 2, simon: 1, daniel: 1}