Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Popular Words solution in Uncategorized category for Popular Words by Elena_Korljukova
"use strict";
function popularWords(text: string, words: string[]) {
var arr = {}
for (let word of words)
arr[word] = text.toLowerCase().split(/\s/).filter(x => x == word).length;
return arr;
}
console.log('Example:')
console.log(popularWords(`
When I was One
I had just begun
When I was Two
I was nearly new`, ['i', 'was', 'three', 'near']))
June 21, 2020
Comments: