JavaScript How to check if string contains substring in JavaScriptBy Rahul2 Mins ReadThe JavaScript indexOf() method search for the substring in string and returns the position of the first occurrence of a…