| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith | [Back] [Original] |
Get to know MDN better
const str1 = "Cats are the best!";
console.log(str1.endsWith("best!"));
// : true
console.log(str1.endsWith("best", 17));
// : true
const str2 = "Is this a question?";
console.log(str2.endsWith("question"));
// : false
endsWith(searchString)
endsWith(searchString, endPosition)
searchStringendPosition searchString searchString +1 str.length
searchString true false
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
| ECMAScript 2027 LanguageSpecification # sec-string.prototype.endswith |
Stringanchor()at()big()blink()bold()charAt()charCodeAt()codePointAt()concat()endsWith()fixed()fontcolor()fontsize()includes()indexOf()isWellFormed()italics()lastIndexOf()link()localeCompare()match()matchAll()normalize()padEnd()padStart()repeat()replace()replaceAll()search()slice()small()split()startsWith()strike()sub()substr()substring()sup()toLocaleLowerCase()toLocaleUpperCase()toLowerCase()toString()toUpperCase()toWellFormed()trim()trimEnd()trimStart()valueOf()[Symbol.iterator]()Object/Function| Web Proxy Viewer | New URL | Original Page |