js include function code example
Example 1: string contains js
var str = "foobar"
var regex = /foo/g;
if (str.search(regex) !== -1) {
alert("string conains foo!")
}
Example 2: javascript includes method
arr.includes(searchElement[, fromIndex = 0])