728x90
includes()
includes() 메서드는 문자열 포함 여부를 검색하여 불린(true, false)으로 반환합니다.
"문자열".includes(검색값)
"문자열".includes(검색값, 시작값)
"문자열".includes(검색값, 시작값)
const str1 = "javascript reference";
const currentStr1 = str1.includes("javascript");
const currentStr2 = str1.includes("j");
const currentStr3 = str1.includes("b");
const currentStr4 = str1.includes("reference");
const currentStr5 = str1.includes("reference", 1);
const currentStr6 = str1.includes("reference", 11);
const currentStr7 = str1.includes("reference", 12);
결과보기
728x90
반응형
'Javascript' 카테고리의 다른 글
[javascript]search() (3) | 2022.08.22 |
---|---|
[javascript]함수 유형 (3) | 2022.08.22 |
[javascript]padStart() / padEnd() (3) | 2022.08.17 |
[javascript]repeat() (3) | 2022.08.17 |
[javascript]concat() (3) | 2022.08.17 |
댓글