string.includes(str)
ex
let a = "hi my name is...";
let b = "my";
console.log(a.includes(b)); //true
string.indexOf(str)
ex
let a = "hi my name is...";
let b = "mh";
console.log(a.indexOf(b)); //-1
string이 해당 문자를 가지고 있지 않으면 -1을 반환한다.
string.search(str)
ex
let a = "hi my name is...";
let b = "mh";
console.log(a.search(b)); //-1
/str/.test(string)
ex
let a = "hi my name is...";
let b = "mh";
console.log(/b/.test(a)); //false
string.match(str)
ex
let a = "hi my name is...";
let b = "my";
console.log(a.match(b));
//[ 'my', index: 3, input: 'hi my name is...', groups: undefined ]
match는 확인하려는 str의 index를 알려준다.