Function capitalize

  • Converts the first character of string to upper case and the remaining to lower case.

    Parameters

    • string: string

      string to convert

    Returns string

    capitalized string

    Example

    const result = capitalize('JOHN');
    console.log(result);
    // => 'John'