String.endsWith

endsWith — Check if the string ends with this string.

Description

String.endsWith(string string)

Parameters

Name Description Type Default Optional
string string No

Return values

boolean primitive.

Changelog

Version Description
ES 6 Introduced.

Examples

Example #1 – endsWith example
console.log('Hello World'.endsWith('World')); // true console.log('Hello World'.endsWith('Hello')); // false

External references