Skip to content

All topics  /  JavaScript

How to Get String Convert to Uppercase in Javascript?

JavaScript ·

Now, let's see article of how to get string convert to uppercase in javascript. it's simple example of javascript string touppercase() method. we will help you to give example of string.prototype.touppercase() - javascript. you'll learn javascript string touppercase() method.

To convert a string to uppercase in JavaScript, you can use the toUpperCase() method. Here's an example:

Example 1:


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>How to Get String Convert to Uppercase in Javascript? - NiceSnippets.Com</title>
</head>
<body>
</body>
<script type="text/javascript">
    let myString = "hello world";
    let upperCaseString = myString.toUpperCase();.

    
    console.log(upperCaseString); // Output: HELLO WORLD
</script>
</html>

In this example, we first initialize a variable called `myString` with the value "hello world". We then call the `toUpperCase()` method on this string and assign the result to a new variable called `upperCaseString`. Finally, we log the value of `upperCaseString` to the console, which outputs "HELLO WORLD".