Not understanding the logic


this 2nd loop is pushing any word starting with first letter of my name .isn't this wrong?


Not necessarily but the code you write at this point is also not complete. You would need to modify it to push to the hits array all occurrences of your name or target string