AppDividend
Latest Code Tutorials

Javascript String ToUpperCase Example | String.prototype.toUpperCase() Tutorial

0

Javascript String ToUpperCase Example | String.prototype.toUpperCase() Tutorial is today’s topic. The String toUpperCase() method converts a string to uppercase letters. Javascript String toUpperCase() method returns the calling string value converted to uppercase.  The String toUpperCase() method does not affect the value of the string itself since JavaScript strings are immutable. You cannot call this method on null or undefined. If you call them, you will get a TypeError will be thrown.

Javascript String ToUpperCase Example

If you want to lowercase, you characters then check out toLowerCase example. The toUpperCase() method does not take any arguments and returns a converted uppercase string. See the syntax below.

string.toUpperCase()

Let’s see the example.

// app.js

let strA = 'avengers will be a great movie';
console.log(strA.toUpperCase());

The output is following.

 

Javascript String ToUpperCase Example

The String toUpperCase() function converts an entire string to the Upper case. The function does not affect any of the special characters, digits and the alphabets that are already in the upper case.

See more examples.

// app.js

console.log('appdividend'.toUpperCase());
console.log('krunallathiya'.toUpperCase());

See the output below.

 

String.prototype.toUpperCase() Tutorial

Finally, Javascript String ToUpperCase Example or String.prototype.toUpperCase() Tutorial is over.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.