“String.Containt JavaScript” Code-Antworten

JavaScript String enthält

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

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

String enthält in JavaScript

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

console.log(string.includes(substring));
2 Programmers 1 Bug

JavaScript -Zeichenfolge enthält die Funktion

s = "Hello world";
console.log(s.includes("world"));
Curious Cormorant

JavaScript enthält Substring

var str = "We got a poop cleanup on isle 4.";
if(str.indexOf("poop") !== -1){
	alert("Not again");
}
//use indexOf (it returns position of substring or -1 if not found)
Grepper

String.Containt JavaScript

var str = "We got a poop cleanup on isle 4.";
if(str.indexOf("poop") !== -1){
	alert("Not again");
}
Misty Manatee

String.Containt JavaScript

let string = "This string contains pizza";
if(string.includes("pizza") {
	console.log("It's pizza time!");   
}
Bench Cubed

Ähnliche Antworten wie “String.Containt JavaScript”

Fragen ähnlich wie “String.Containt JavaScript”

Weitere verwandte Antworten zu “String.Containt JavaScript” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen