“JavaScript String Termasuk” Kode Jawaban

Periksa JavaScript Substring

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

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

JavaScript string berisi

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

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

string berisi dalam javascript

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

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

string javascript berisi fungsi

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

JavaScript berisi 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

JavaScript String Termasuk

const s = 'I am going to become a FULL STACK JS Dev with Coderslang';

console.log(s.includes('FULL STACK'));     // true
console.log(s.includes('cheeseburger'));   // false
Mysterious Monkey

Jawaban yang mirip dengan “JavaScript String Termasuk”

Pertanyaan yang mirip dengan “JavaScript String Termasuk”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya