Answers for "string include"

23

check for substring javascript

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

console.log(string.includes(substring));  //true
Posted by: Guest on July-06-2020
29

javascript string includes

'Blue Whale'.includes('blue')  // returns false
Posted by: Guest on March-19-2020
7

.includes( string

var str = "Hello world, welcome to the universe.";
var n = str.includes("world");
Posted by: Guest on November-14-2019
6

string.contains javascript

var str = "We got a poop cleanup on isle 4.";
if(str.indexOf("poop") !== -1){
	alert("Not again");
}
Posted by: Guest on April-28-2020
0

string include

const sentence = 'The quick brown fox jumps over the lazy dog.';
const word = 'fox';

console.log(`The word "${word}" ${sentence.includes(word) ? 'is' : 'is not'} in the sentence`);
// expected output: "The word "fox" is in the sentence"
Posted by: Guest on June-22-2021

Browse Popular Code Answers by Language