30-Days-Of-JavaScript | 30 days of JavaScript programming challenge | Learning library
kandi X-RAY | 30-Days-Of-JavaScript Summary
kandi X-RAY | 30-Days-Of-JavaScript Summary
30 days of JavaScript programming challenge is a step-by-step guide to learn JavaScript programming language in 30 days. This challenge may take more than 100 days, please just follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of 30-Days-Of-JavaScript
30-Days-Of-JavaScript Key Features
30-Days-Of-JavaScript Examples and Code Snippets
Community Discussions
Trending Discussions on 30-Days-Of-JavaScript
QUESTION
I have a question that asked me to:
Clean the following text and find the most frequent word: "const sentence = '%I $am@% a %tea@cher%, &and& I lo%#ve %te@a@ching%;. The@re $is no@th@ing; &as& mo@re rewarding as educa@ting &and& @emp%o@weri@ng peo@ple. ;I found tea@ching m%o@re interesting tha@n any ot#her %jo@bs. %Do@es thi%s mo@tiv#ate yo@u to be a tea@cher!? %Th#is 30#Days&OfJavaScript &is al@so $the $resu@lt of &love& of tea&ching'
"
I used regEx to clean the string like this:
...ANSWER
Answered 2022-Mar-28 at 09:04I wouldn't change the spaces to "1". Instead use a regex that will not remove spaces while cleaning.
Then you can call match
on the cleaned string, and use reduce
to start counting words and maintain a reference to the most frequent one:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install 30-Days-Of-JavaScript
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page