The loop is counting my name too many times. There's only three but it counts 24


Here's my code. Any help is appreciated.


"Here's my code."

Sadly, anything but. This is not your code, it is a picture that nobody can do anything with except look at it. We cannot select from your code, only trouble ourselves to see and retype it. If you want help, make it easy for others to help. Please post your code, not a picture of it. Thank you.


Change your
hits.push( text[j] );


Sorry never posted here before. So what do I do... Just copy and paste my code or is there some kind of trick.


Enter a blank line and go to the next. Paste in your code, then select it and click the </> button in the tool tray (or press Ctrl/Cmd + K). That will preserve the indentation and publish your code as <pre> formatted text with code typeface.

The same can be done when we type in code. Just type the lines with indents as apply, select the block of code and </>. Use four space characters at the start of a line of code for the same effect.

console.log("<pre>code sample</pre>")


Did I miss a lesson where they taught that? I don't remember ever using text[?].