Verifique se há javascript de substring
const string = "javascript";
const substring = "script";
console.log(string.includes(substring)); //true
Batman
const string = "javascript";
const substring = "script";
console.log(string.includes(substring)); //true
'Bandeira do Brasil'.includes('brasil'); // returns false
'Bandeira do Brasil'.includes('Brasil'); // returns true
var string = "foo";
var substring = "oo";
console.log(string.indexOf(substring) !== -1);
let example = "Example String!";
let ourSubstring = "Example";
if (str.includes(ourSubstring, 7)) {
console.log("The word Example is in the string.");
} else {
console.log("The word Example is not in the string");
}
let example = "Example String!";
let ourSubstring = "Example";
if (example.indexOf(ourSubstring) != 0) {
console.log("The word Example is in the string.");
} else {
console.log("The word Example is not in the string.");
}
let str = "Example String!";
/Example/.test(str);