JavaScript tutorial:
toUpperCase method

 

Applies to: String Object

The toUpperCase method returns a string where all alphabetic characters have been converted to uppercase.

Syntax

strVariable.toUpperCase( )
"String Literal".toUpperCase( )

Return

The toUpperCase method convert specfic string to Uppercase and return the converted string.

Example

The toUpperCase method has no effect on nonalphabetic characters.

The following example demonstrates the effects of the toUpperCase method:

strVariable = "change everything to upper case";
strVariable = strVariable.toUpperCase( );
document.write(strVariable);

To run the code, paste it into JavaScript Editor, and click the Execute button.

See also: String Object Methods, String Object Properties, toLowerCase Method