A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/javascript-string-touppercase-method/ below:

JavaScript String toUpperCase() Method - GeeksforGeeks

JavaScript String toUpperCase() Method

Last Updated : 16 Sep, 2024

JavaScript String toUpperCase() method converts the entire string to Upper case.

This method does not affect any of the special characters, digits, and the alphabets that are already in the upper case. 

Syntax:
str.toUpperCase()
Parameters:

This method does not accept any parameter.

Return value:

This method returns a new string in which all the lowercase letters are converted to uppercase.

Example 1: In this example, we are converting the given string to uppercase.

JavaScript
let str = 'geeksforgeeks';
let string = str.toUpperCase();
console.log(string);

Example 2: In this example, the method toUpperCase() converts all the lower case alphabets to their upper case equivalents without affecting the special characters and the digits. 

JavaScript
// JavaScript String toUpperCase() method
// to convert string to Uppercase

// Original string
let str = 'It iS a 5r&:ampe@@t Day.'

// String converted to Upper Case
let string = str.toUpperCase();

console.log(string);

Output
IT IS A 5R&:AMPE@@T DAY.

Example 3: In this example, we are creating an array of data with elements 'javascript', 'html', and 'css'. It uses map() and toUpperCase() to convert each element to uppercase.

JavaScript
let data = [ 'javascript', 'html', 'css' ];

let result = data.map(data => data.toUpperCase());

console.log(result);

Output
[ 'JAVASCRIPT', 'HTML', 'CSS' ]
Supported Browsers:

JavaScript String toUpperCase() & toLowerCase() Method

Visit Course JavaScript String toUpperCase() & toLowerCase() Method Javascript Program to Convert from Lowercase to Uppercase

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4