Options
All
  • Public
  • Public/Protected
  • All
Menu

Module endsWith

Index

References

Functions String

References

Renames and re-exports endsWith

String Functions

  • endsWith(str: string, target: string, position?: number): boolean
  • Checks if string ends with the given target string.

    since

    5.7.0

    see

    includes,startsWith

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

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

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

    Parameters

    • str: string

      The string to inspect.

    • target: string

      The string to search for.

    • position: number = str.length

      The position to search up to.

    Returns boolean

    Returns true if string ends with target, else false.