.toUpperCase()
christian.dinh2476 total contributions
Published Jun 19, 2021Updated Jun 19, 2024
Contribute to Docs
In JavaScript, the .toUpperCase()
method converts the lowercase letters of a string to uppercase.
Syntax
string.toUpperCase();
string
: The string to be used for conversion.
Example 1
Here is an example that demonstrates the usage of the .toUpperCase()
method:
console.log('hello world'.toUpperCase());
The output of the above code is as follows:
HELLO WORLD
Example 2
The .toUpperCase()
method doesn’t modify the original string, as shown below:
var state = 'ny';state.toUpperCase();console.log(state);console.log(state.toUpperCase());
The above code produces the following output:
nyNY
Codebyte Example
Here is a codebyte example that shows the use of the .toUpperCase()
method:
All contributors
- christian.dinh2476 total contributions
- Anonymous contributorAnonymous contributor3071 total contributions
- EugeneGoh_51 total contributions
- ivaaane3 total contributions
- Anonymous contributorAnonymous contributor1 total contribution
- christian.dinh
- Anonymous contributor
- EugeneGoh_
- ivaaane
- Anonymous contributor
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.