JavaScriptStringendsWith
concat

endsWithString

includes

Determines whether a string ends with the characters of a specified string.

Syntax

str.endsWith(searchStr, endPos?)

Example

Enter values below to update the example in real time.

const
filename
console
endsWith
const filename = "report.pdf";
console.log(filename.endsWith(".pdf"));   // true
console.log(filename.endsWith(".txt"));   // false