Now that I looked at it a little bit more, I understand that you want to highlight the searched term if it is found. In that case indexOf returns a number so this should be working with the end of word, which can be searchTerm.lenght and the call to select a range could be setSelectionRange(indexOfFirst, searchTerm.lenght). But anyway, you have to provide two numbers minimum, you can't get away with only one.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Now that I looked at it a little bit more, I understand that you want to highlight the searched term if it is found. In that case
indexOf
returns a number so this should be working with the end of word, which can besearchTerm.lenght
and the call to select a range could besetSelectionRange(indexOfFirst, searchTerm.lenght)
. But anyway, you have to provide two numbers minimum, you can't get away with only one.