transformation

String.prototype.toUpperCase

Returns a new string with all characters converted to upper case using the Unicode default case mapping. Locale-insensitive — use toLocaleUpperCase for language-specific rules (e.g. Turkish i).

str.toUpperCase()

Parameters

Parameter Purpose
(no arguments) Method takes no parameters
returns New upper-cased string (original unchanged)

Examples

console.log('hello'.toUpperCase());

Prints 'HELLO'

console.log('Straße'.toUpperCase());

Prints 'STRASSE'

console.log('abc123'.toUpperCase());

Prints 'ABC123'

const s = 'hi'; s.toUpperCase(); console.log(s);

Prints 'hi' (original unchanged; strings immutable)

Gotcha

Not locale-aware — Turkish 'i' becomes 'I' instead of 'İ'. Some characters expand (ß to SS), so length can change.

Related methods

← All JS string methods · JS array methods