Introduction
- Lower Case
- Upper Case
- Title Case
We will see the conversion one by one below. To convert a text into lowercase using JavaScript:
You can use this as in the following:
- function toLowerCase(str) {
- return str.toLowerCase();
- }
- alert(toLowerCase("HELLO WORLD"));
- function toUpperCase(str) {
- return str.toUpperCase();
- }
- alert(toUpperCase("hello world"));
- function toTitleCase(str) {
- return str.replace(/\w\S*/g,
- function (txt) {
- return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
- });
- }
- alert(toTitleCase("hello world"));

Comments
Join the conversation! Your thoughts help the community grow.