Function startsWith

  • Checks if string starts 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 from.

    Returns boolean

    Returns true if string starts with target, else false.

    3.0.0

    endsWith, includes

    startsWith('abc', 'a')
    // => true

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

    startsWith('abc', 'b', 1)
    // => true