String Function Case Conversion
Method or Function: toUpperCase(), toLowerCase()
Syntax:String.toUpperCase()
Syntax:String.toLowerCase()
We can convert a string to lower case or upper case in JavaScript.
toUpperCase() method converts any string to "UPPER" case letters.
toLowerCase() method converts any string to "lower" case letters.
Converting to Upper Case:
Example: 1
<script type="text/javascript">
var x = " This is a upper case text ";
document.write(x.toUpperCase());
</script>
var x = " This is a upper case text ";
document.write(x.toUpperCase());
</script>
Converting to Lower Case:
Example: 2
<script type="text/javascript">
var x = " This is a lower case text ";
var y = x.toLowerCase();
document.write(y);
</script>
var x = " This is a lower case text ";
var y = x.toLowerCase();
document.write(y);
</script>
No comments:
Post a Comment