String.toUpperCase()

JavaScript1.0+, JScript1.0+, ECMAScript1.0+ NES2+, Nav2+, IE3+, Opera3+ Syntax

							string.toUpperCase()

Description

The toUpperCase() method of an instance of a String object converts the characters in that string to all uppercase values. This is often used when a programmer is trying to evaluate a string a user has entered, and case is not an issue.

Example

Listing 6.260 pops up a prompt box and asks the user to enter various case text. After the user clicks OK, the uppercase version of the string is written to the page.

Listing 6.260 Using the toUpperCase() Method of the String Object to Convert a String Entered by a User to Uppercase
 <script language="JavaScript"> <!–– Hide // Create an instance of the String object ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.