Javascript word-counter

Hi, I would love to get feedback about my project ‘‘word-counter’’ you write a text and the program will say how many times you repeated a word.

Also, I need help with a (I think I can call it a bug) that happens when the user first write a text. My textarea comes with some default spaces already in it.

Thanks everyone ;D

1 Like

Hi @Newt ! Congratulations on your work! :clap: :clap:
I liked your selection of colors and font. :+1:

Regarding the JS code I would add the option that when a word is used only once, then phrase has a different value ("You have written $ {word} only once." , Eg.) :wink:

Regarding the “bug” you comment: you have a line break and several spaces in the textarea, before the </textarea> tag.

You can check it in the console:

let mysteriousBlanks = document.querySelector("textarea");

You can also verify that the error is fixed by removing them:

mysteriousBlanks.textContent = "";

Cheers and happy coding! :keyboard: :muscle: