320x100
320x100
기본 문법
str.endsWith(searchString[, length])
- searchString
: 끝나는지 찾을 문자열
- length
: 찾고자 하는 문자열의 길이 값
: 기본 값으로는 문자열 전체 길이
- 반환 값
: 문자열의 끝이 주어진 문자열로 끝나면 true / false
var str = 'To be, or not to be, that is the question.';
console.log(str.endsWith('question.')); // true
console.log(str.endsWith('to be')); // false
console.log(str.endsWith('to be', 19)); // true
Refference
String.prototype.endsWith() - JavaScript | MDN
The endsWith() 메서드를 사용하여 어떤 문자열에서 특정 문자열로 끝나는지를 확인할 수 있으며, 그 결과를 true 혹은 false로 반환한다.
developer.mozilla.org
300x250
728x90
'Programming > JavaScript' 카테고리의 다른 글
| NodeJS NODE_ENV 값으로 개발/배포 모드 분기하기 (0) | 2022.07.22 |
|---|---|
| NodeJS 개발을 위한 Eslint 및 Prettier 적용 방법 (0) | 2022.07.09 |
| nodeJS에서 axios를 활용하여 SOAP 통신하기 (NodeJS Soap Client) (0) | 2022.05.29 |
| NodeJS와 ExpressJS에 대해서 (0) | 2022.05.05 |
| [NodeJS] Youtube API v3 ESLint 기준에 맞춘 소스코드 (0) | 2022.04.30 |