To check if a string contains a specific character in Javascript, call the String. indexOf method , e.g. string. indexOf(myChar) .
Read moreHow do you check if a string contains a substring JavaScript?
Javascript check if string contains substring using includes() Javascript includes() method is used to perform a case-sensitive search to find out if a particular string is contained within another string. The includes() method returns true if the substring is found else, it will return false.
Read moreWhat does Includes () do in JavaScript?
In JavaScript, includes() method determines whether a string contains the given characters within it or not . This method returns true if the string contains the characters, otherwise, it returns false.
Read more