Checks if string ends with the given target string.
string
Optional
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
3.0.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.