🚨 Get Your Free NFT Certificate Mint by Completing the Web3 Exam! START NOW

Code has been added to clipboard!


Reading time 2 min
Published Sep 8, 2017
Updated Oct 2, 2019

JavaScript upperCase: Main Tips

  • This method is used to convert all letters in a specified string to JavaScript uppercase.
  • The toUpperCase() method does not affect the original string, returning a new modified string instead.

Function Explained

Once you apply JavaScript toUpperCase() method to a string, all of the lower case letters will be capitalized. Therefore, JavaScript upperCase method is perfectly-suited for quickly converting all letters in a specified string in JavaScript uppercase.

However, there are some additional factors you have to bear in mind. For instance, the toUpperCase JavaScript method will not modify numbers, special characters and will retain the originally-capitalized letters.

Furthermore, the original string you want to change with the JavaScript toUpperCase() function won't be modified. Instead, the method generates a new string with all letters properly capitalized.

This example illustrates how you can easily capitalize letters with the toUpperCase JavaScript method:

var str = "Hi, Mark!";
var res = str.toUpperCase();

By using the JavaScript upperCase function, we can also implement the JavaScript capitalize first letter task. In cases when you only want to have the first letter capitalized, you should apply uppercaseFirstLetter to strings.

Tip: toLowerCase() method can be used for converting the string to lowercase letters.

  • Easy to use with a learn-by-doing approach
  • Offers quality content
  • Gamified in-browser coding experience
  • The price matches the quality
  • Suitable for learners ranging from beginner to advanced
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid Certificates of completion
  • Easy to navigate
  • No technical issues
  • Seems to care about its users
Main Features
  • Huge variety of courses
  • 30-day refund policy
  • Free certificates of completion

Learn Standard Syntax

As you can see from the example below, the rules for writing JavaScript toUpperCase function do not require to remember many things. The most prominent feature is the capitalization of the method which you should attempt to keep in your code:


You should notice that parentheses are empty, meaning that it does not take any arguments.

Return Value

The JavaScript upperCase method will return an obvious value: a newly-generated string. All of the letters in the string will be capitalized, while the original string remains the same.

Return Value: A string, which represents the original string with the letters all converted to uppercase.
JavaScript Version: ECMAScript 1