Converting to Lower Case and Upper Case in JavaScript

by: Amrit Hallan

Converting to lower case and upper case in JavaScript

To convert a string to lower case in JavaScript we use the following steps:

var sometext=”This is some text.”;
var casechanged=sometext.toLowerCase();

Now the variable casechanged contains “this is some text.”. For upper case in JavaScript:

var sometext=”This is some text.”;
var casechanged=sometext.toUpperCase();

Now the variable casechanged contains “THIS IS SOME TEXT.”.



Article published Wednesday, 19th October 2005
© 2008 NetVisits, Inc. All rights reserved.