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


#1

Here's my code. Any help is appreciated.


#2

"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.


#3

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


#4

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


#5

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>")

#6

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