Function endsWith

  • Checks if string ends with the given target string.

    Parameters

    • Optionalstring: string

      The string to inspect.

    • Optionaltarget: string

      The string to search for.

    • Optionalposition: number

      The position to search up to.

    Returns boolean

    Returns true if string ends with target, else false.

    3.0.0

    includes, startsWith

    endsWith('abc', 'c')
    // => true

    endsWith('abc', 'b')
    // => false

    endsWith('abc', 'b', 2)
    // => true