_.endsWith

_.endsWith([string=''], [target], [position=string.length])

Checks if string ends with the given target string.

Since

3.0.0

Arguments

  1. [string=''] (string): The string to inspect.
  2. [target] (string): The string to search for.
  3. [position=string.length] (number): The position to search up to.

Returns

(boolean): Returns true if string ends with target, else false.

Example

1
2
3
4
5
6
7
8
_.endsWith('abc''c');
// => true
  
_.endsWith('abc''b');
// => false
  
_.endsWith('abc''b', 2);
// => true
doc_Lodash
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.