You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might be a somewhat pedantic issue, but working through the javascript course, I wrote my own code first, then comparedd it to yours and found a couple of pretty obvious bugs with the word count feature.
As someone who has bought all your courses, let me say in advance that I really enjoy your lecture style and command of the material, so this is really just something for those who are trying to dig beneath the surface level of the projects, or trying out variations using their own code.
Since the word count splits on a space constant, the number of words will be off if:
any whitespace is added, so in your video even though you have 4 words, the word count is 5 as you type once you add an extra space.
adding some whitespace before or after throws off the word count and the check for an empty entry
with the space constant ' ', split doesn't understand other whitespace characters like newlines and tabs
This can of course be fixed fairly easily with some simple regex and slight variation to your code (my variable names might be different from yours):
This might be a somewhat pedantic issue, but working through the javascript course, I wrote my own code first, then comparedd it to yours and found a couple of pretty obvious bugs with the word count feature.
As someone who has bought all your courses, let me say in advance that I really enjoy your lecture style and command of the material, so this is really just something for those who are trying to dig beneath the surface level of the projects, or trying out variations using their own code.
Since the word count splits on a space constant, the number of words will be off if:
This can of course be fixed fairly easily with some simple regex and slight variation to your code (my variable names might be different from yours):
const numwordsEl = document.querySelector(".stat__number--words");
In the input handler function...
The text was updated successfully, but these errors were encountered: