String toUpperCase() Method - Javascript String

Javascript examples for String:toUpperCase

Description

The toUpperCase() method converts a string to uppercase letters.

The toUpperCase() method does not change the original string.

Parameters

None.

Return Value:

A String, representing the value of a string converted to uppercase

The following code shows how to Convert the string to uppercase letters:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*w w  w.  j  ava 2 s . c o  m*/
    var str = "Hello World!";
    var res = str.toUpperCase();
    document.getElementById("demo").innerHTML = res;
}
</script>

</body>
</html>

Related Tutorials