Horje
How to Convert a String to Uppercase in JavaScript ?

In JavaScript, you can convert a string to uppercase using the toUpperCase() method, which is available on string objects. This method returns a new string with all alphabetic characters converted to uppercase.

Syntax:

string.toUpperCase()
  • string: The string that you want to convert to uppercase.

Example: Here, the toUpperCase() method is called on the str string, converting all lowercase letters to uppercase. The resulting string, "HELLO WORLD", is assigned to the variable upperStr.

Javascript

const str = "hello world";
const upperStr = str.toUpperCase();
 
console.log(upperStr); // Output: "HELLO WORLD"

Output

HELLO WORLD



Reffered: https://www.geeksforgeeks.org


JavaScript

Related
What is hasOwnProperty() method in JavaScript ? What is hasOwnProperty() method in JavaScript ?
How to Lowercase a String in JavaScript ? How to Lowercase a String in JavaScript ?
What is includes() Method in JavaScript ? What is includes() Method in JavaScript ?
What is endsWith() Method in JavaScript ? What is endsWith() Method in JavaScript ?
What is anchor() Method in JavaScript ? What is anchor() Method in JavaScript ?

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
11