Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Popular Words solution in Clear category for Popular Words by Atadolfo
"use strict";
var popularWords = (text: string, words: string[]) => words.reduce((r: any, w: string) => {r[w] = (text.match(new RegExp("\\b" + w + "\\b", "gmi"))||[]).length; return r}, {});
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']))
April 26, 2020
Comments: