Whenever you use toUpperCase() on a string, the method does the following:
- It converts its calling string to uppercase.
- It returns the new version of the calling string—without changing the original string.
A calling string is a string on which you used
toUpperCase(). So, in
"Hello, World!" is the calling string.
Syntax of the
The snippet above shows that
toUpperCase() does not accept any argument.
Example 1: Convert
CodeSweetly to Uppercase
// The invocation above will return: "CODESWEETLY"
"friday, my friend, was born on friday".toUpperCase();
// The invocation above will return: "FRIDAY, MY FRIEND, WAS BORN ON FRIDAY"
toUpperCase() returns the uppercase version of its calling string.
If you like this article, please Tweet it.
Thanks for reading!