Checks if string ends with the given target string.
string
The string to inspect.
The string to search for.
The position to search up to.
Returns true if string ends with target, else false.
true
target
false
5.7.0
[[includes]],[[startsWith]]
endsWith('abc', 'c')// => trueendsWith('abc', 'b')// => falseendsWith('abc', 'b', 2)// => true Copy
endsWith('abc', 'c')// => trueendsWith('abc', 'b')// => falseendsWith('abc', 'b', 2)// => true
Checks if
string
ends with the given target string.