JavaScript Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Java-Script Tutorial
Introduction Introduction
Variables Variables
Operators Operators
Statements Statements
Loops Loops
Functions Functions
Objects Objects
Arrays Arrays
Cookies JS Cookies
Browser Objects Browser Objects
Form DOM Form DOM
Style Objects DOM Style Objects
Forums Ask Your Doubts
Scraps More about Javascript
Feedback Feedback
 




String Function - case conversion


Tutorials Javascript

Topic

how to convert a lower case alphabet to upper case and vice versa in javascript?



Explanation

Object: String

Method or Function: toLowerCase(), toUpperCase()

Description: These methods are used to cover a string or alphabet from lower case to upper case or vice versa. e.g: "and" to "AND".

Converting to Upper Case:
Example Code:
<script language=javascript>
var ss = " testing case conversion method ";
var result = ss.toUpperCase();
document.write(result);
</script>

Result:

Converting to Lower Case:
Example Code:
<script language=javascript>
var ss = " TESTING LOWERCASE CONVERT FUNCTION ";
var result = ss.toLowerCase();
document.write(result);
</script>

Result:

Explanation:
In the above examples,
  • toUpperCase() method converts any string to "UPPER" case letters.
  • toLowerCase() method converts any string to "lower" case letters.





  • A Note
    Javascript (JS) is one of the most used languages in the world. Some times spelled as Java Script. Hope you enjoy this tutorial. Do send your feedback or suggestions on this javascript or java script tutorial. This is a copyright content.

    Other Links

    web hosting