How to check whether a string contains a substring in JavaScript?

Asked 2023-09-20 19:54:40 View 16,466

Usually I would expect a String.contains() method, but there doesn't seem to be one.

What is a reasonable way to check for this?

Answers