Skip to main content

toUpper()

toUpper(str): string

Converts a string to uppercase.

DEPRECATED

Use string.toUpperCase() directly instead.


Parametersโ€‹

str: string | null | undefinedโ€‹

The string to convert to uppercase.


Returns: stringโ€‹

The string converted to uppercase.


See Alsoโ€‹


Sinceโ€‹

2.0.0


Also known asโ€‹

toUpper (Lodash, es-toolkit, Ramda) ยท toUpperCase (Remeda, Effect) ยท โŒ (Radashi, Modern Dash, Antfu)


Exampleโ€‹

// โŒ Deprecated approach
toUpper('hello world'); // => 'HELLO WORLD'

// โœ… Recommended approach
'hello world'.toUpperCase(); // => 'HELLO WORLD'

How it works?โ€‹

Converts string to uppercase. Deprecated: Use string.toUpperCase() directly.

Native Equivalentโ€‹

// โŒ toUpper('hello')
// โœ… 'hello'.toUpperCase()

Use Casesโ€‹

Convert to uppercase ๐Ÿ“Œโ€‹

Convert string to uppercase.

'hello'.toUpperCase();  // 'HELLO'

Format constantsโ€‹

Format text for display.

const header = title.toUpperCase();