Programming Skills/es6
ES6- ES2015 string에 새로운 메서드들
Ideveloper2
2018. 2. 16. 00:50
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에 새로 추가된 배열관련 메서드들이나, 기존의 스트링,배열관련 메서드들을 확인할 수 있다.