my code is OK
but I see in console
10,43: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
10,50: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
assert.strictEqual(mostWanted("Lorem ipsum dolor sit amet"), "m");
this is my code, test "Lorem ipsum dolor sit amet" is OK
function mostWanted(text){
let txt = text.toLowerCase().replaceAll(' ', '').
replaceAll('!', '').replaceAll(',', '').replaceAll('.', '').split('').filter(el => isNaN(el));
let ob = {};
txt.forEach(
el => {ob[el] = (ob[el] ?? 0) + 1; }
)
return Object.entries(ob).sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))[0][0];
}
Created at: 2023/05/18 15:04; Updated at: 2023/05/18 15:04