Function capitalize

  • Capitalizes the first letter of a string.

    Time complexity: O(n)

    Space complexity: O(n)

    Type Parameters

    • T extends string

    Parameters

    • text: T

      Text to capitalize

    Returns Capitalize<T>

    Capitalized string

    String

    capitalize('hello'); // 'Hello'
    

    uncapitalize for the inverse operation