Encodera

Thanks for reading!

Donate to the site — we work hard for you.

JavaScript reference

String.prototype.toUpperCase

Converts a string to uppercase.

Available since: ES1

Syntax

str.toUpperCase()

Return value

stringA new string with every letter uppercased.

Examples

Works with letters of any alphabet:

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

Output:

HELLO, WORLD

The reverse method is toLowerCase():

console.log('HELLO, World'.toLowerCase());

Output:

hello, world

Notes

The original string is not modified — store the result in a variable.

See also

Related recipes

In the tutorial

  • String methods — Useful string methods in JavaScript: finding a position, reading characters, padStart, repeat, split and join, method chains.

Thanks for reading!

Donate to the site — we work hard for you.