Free Guides
Language Tutorials

JavaScript
Strings Handling
Converting Lower case text to Uppercase in JavaScript
We can convert lowercase letter to upper case letter by using toUpperCase() method in JavaScript. This you must have seen in some sites were after entering your user id and when we come out of input box, it changes to uppercase. Here this function toUpperCase() is used along with a event handler. Here is the basic syntax for toUpperCase method.
var a1 = str.toUpperCase();
Here str is our string variable. The new
string ( with uppercase letters ) is stored in new variable a1.
Here is the sample code
var a1 = str.toUpperCase();
document.write(a1);
Converting Uppercase letters to Lower case in JavaScript
We have seen how to convert lower case letter to
uppercase letter. Now we will learn how to convert upper case
letters to lower case letters by using toLowerCase()
functions in JavaScript. Here is the basic syntax for toLowerCase
method.
var a2 = str.toLowerCase();
Here str is our string variable. The new
string ( with lower case letters ) is stored in new variable a2.
Here is the sample code
var a2 = str.toLowerCase();
document.write(a2);
Converting Uppercase letters to Lower case in JavaScript
We have seen how to convert lower case letter to
uppercase letter. Now we will learn how to convert upper case
letters to lower case letters by using toLowerCase()
functions in JavaScript. Here is the basic syntax for toLowerCase
method.
Here str is our string variable. The new
string ( with lower case letters ) is stored in new variable a2.
Here is the sample code
var a2 = str.toLowerCase();
document.write(a2);