Baseline Widely available
String
ê°ì endsWith()
ë©ìëë 문ìì´ì´ ì´ ë¬¸ìì´ì 문ìë¡ ëëëì§ ì¬ë¶ë¥¼ ê²°ì íì¬ ì ì íê² true
ëë false
를 ë°íí©ëë¤.
const str1 = "Cats are the best!";
console.log(str1.endsWith("best!"));
// Expected output: true
console.log(str1.endsWith("best", 17));
// Expected output: true
const str2 = "Is this a question?";
console.log(str2.endsWith("question"));
// Expected output: false
구문
endsWith(searchString)
endsWith(searchString, endPosition)
매ê°ë³ì
searchString
str
ëìì ê²ìí 문ì. ì ê· ííìì´ ë ì ììµëë¤. ì ê·ìì´ ìë 모ë ê°ì [문ìì´ë¡ ê°ì ë³í]ëë¯ë¡ ì´ë¥¼ ìëµíê±°ë undefined
를 ì ë¬íë©´ endsWith()
ê° "undefined"
문ìì´ì ê²ìíê² ëëë°, ì´ë ìíë ê²½ì°ê° ê±°ì ììµëë¤.
endPosition
Optional
searchString
ì´ ë°ê²¬ë ê²ì¼ë¡ ììëë ë ìì¹(searchString
ì ë§ì§ë§ 문ìì ì¸ë±ì¤ì 1ì ëí ê°)ì
ëë¤. 기본ê°ì str.length
ì
ëë¤.
searchString
ì´ ë¹ ë¬¸ìì´ì¸ ê²½ì°ë¥¼ í¬í¨íì¬ ë¬¸ìì´ ëì 주ì´ì§ 문ìê° ìì¼ë©´ **true
**를 ë°ííê³ , ê·¸ë ì§ ìì¼ë©´ **false
**를 ë°íí©ëë¤.
TypeError
searchString
ê° ì ê· ííìì´ë¼ë©´ ë°ìí©ëë¤.
ì´ ë©ìë를 ì¬ì©íë©´ 문ìì´ì´ ë¤ë¥¸ 문ìì´ë¡ ëëëì§ ì¬ë¶ë¥¼ íì¸í ì ììµëë¤. ì´ ë©ìëë ëì문ì를 구ë¶í©ëë¤.
ìì endsWith() ì¬ì©í기const 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
ëª
ì¸ì ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4