“JS String berisi” Kode Jawaban

Periksa JavaScript Substring

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

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

JS String berisi

'Bandeira do Brasil'.includes('brasil'); // returns false
'Bandeira do Brasil'.includes('Brasil'); // returns true
GutoTrosla

JS String berisi

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

console.log(string.indexOf(substring) !== -1);
2 Programmers 1 Bug

JS String berisi

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");
}
cadot.eu

JS String berisi

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.");
}
cadot.eu

JS String berisi

let str = "Example String!";

/Example/.test(str);
cadot.eu

Jawaban yang mirip dengan “JS String berisi”

Pertanyaan yang mirip dengan “JS String berisi”

Lebih banyak jawaban terkait untuk “JS String berisi” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya