constfindMostUsedLetter=(str)=>{constfilteredStrToArr=str.replace(/[^a-zA-Z]/g,'').split('').sort()returnfilteredStrToArr.reduce((a,b,index,arr)=>(arr.filter((v)=>v===a).length>=arr.filter((v)=>v===b).length?a:b),null)}console.log(findMostUsedLetter('hey there my friend'))
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Discussion on: #4.Basic algorithms problems for frontend developers.
For further actions, you may consider blocking this person and/or reporting abuse