Page 229 - Web_Application_v2.0_C12_Fb
P. 229
var text = "The rain in Spain stays mainly in the plain.";
document.getElementById("demo1").innerHTML = text.match(/ain/g);
</SCRIPT>
</BODY>
</HTML>
Output:
6. The toUpperCase() Method: The toUpperCase() method converts all characters in a string to uppercase.
Example 36: To demonstrate the use of toUpperCase method
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>toUpperCase() Method</TITLE>
</HEAD>
<BODY>
<H2>The toUpperCase() Method</H2>
<P>The toUpperCase() method converts text to uppercase.</P>
<P id="demo1"></P>
<SCRIPT>
var text = "hello world";
document.getElementById("demo1").innerHTML = text.toUpperCase();
</SCRIPT>
</BODY>
</HTML>
Output:
JavaScript Part 2 227

