Answers for "contains a string javascript"

88

javascript string contains

var string = "foo",
    substring = "oo";

console.log(string.includes(substring));
Posted by: Guest on December-21-2019
0

js string contains

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.");
}
Posted by: Guest on October-12-2021

Code answers related to "contains a string javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language