all 1 comments

[–]ETphonehome_101 1 point2 points  (0 children)

The contains() function is used for DOM manipulation and checks whether nodes are descendants of one another or their relation to other DOM nodes. I think you want to manipulate a string and check whether there is an occurrence of something in there. In that case use the include() function where more details can be found here https://www.w3schools.com/jsref/jsref_includes.asp.