티스토리 뷰
ES2015 string에 새로운 메서드들
//hello로 시작하는지를 어떻게 확인 할까?
let str = "hello world ! ^^~~";
let matchstr = "hello";
let matchstr = "~~";
//1.시작하는 문자열 검사
console.log(str.startsWith(matchstr));
//2.끝나는 문자열 검사
console.log(str.endsWith(matchstr));
//3.문자열 포함여부 검사
console.log(str.includes("world"));
->모든 결과값: true
http://takeuu.tistory.com/102 에 들어가보면, es6에 새로 추가된 배열관련 메서드들이나, 기존의 스트링,배열관련 메서드들을 확인할 수 있다.
'Programming Skills > es6' 카테고리의 다른 글
ES6-from 메서드로 진짜 배열 만들기 (0) | 2018.02.20 |
---|---|
ES6-Spread operator (0) | 2018.02.20 |
ES6-for of 순회하기 (0) | 2018.02.17 |
es6-let과 closure, const (0) | 2018.02.10 |
ES6-es2015 시작하기,let (0) | 2018.02.09 |
댓글