check for substring javascript
snippet in javascript

check for substring javascript

user8145

const string = "javascript";
const substring = "script";

console.log(string.includes(substring));  //true

check if word is in string javascript

user1391

var str = "Hello world, welcome to the universe.";
var n = str.includes("world");

javascript string contains

user2827

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

console.log(string.includes(substring));

javascript check if string contains substring

user5664


var str = "Hello world, welcome to the universe.";

var n = str.includes("world");
 

string contains in javascript

user6480

const string = "foo";
const substring = "oo";

console.log(string.includes(substring));

.includes( string

user6110


var str = "Hello world, welcome to the universe.";
var n = str.includes("world");