Solución
solution.tsTypeScript
export function countWords(...words: string[]): Record<string, number> {
let count = new Map<string, number>()
for(let word of words) {
if(count.has(word)){
count.set(word, count.get(word) + 1)
} else {
count.set(word, 1)
}
}
return Object.fromEntries(count)
}0respuestas