str.endsWith(searchString[, length])
인자
searchString
이 문자열의 끝이 특정 문자열로 끝나는지를 찾기 원하는 문자열입니다.length
Optional 찾고자 하는 문자열의 길이값이며, 기본값은 문자열 전체 길이입니다. 문자열의 길이값은 문자열 전체 길이 안에서만 존재하여야 합니다.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 // 앞에서부터 19길이로 잘랐을 때 "to be"로 끝나는지 검사