Hi Friends đź‘‹,

Welcome to Infinitbility ❤️!

Today, I’m going to show you how to convert a string to uppercase in typescript, here we will use the javascript toUpperCase() method to convert it an uppercase.

So first, we will create some examples variables, then we use the toUpperCase() method on those variables, and then we will check our console it’s working or not.

Let’s start codeing…

let firstStr: string = 'Hello World';
let secondStr: string = 'Infinitbility';
let thirdStr: string = 'IfergUokgIgokr04';

// lets convert it
firstStr = firstStr.toUpperCase();
secondStr = secondStr.toUpperCase();
thirdStr = thirdStr.toUpperCase();

console.log(firstStr, secondStr, thirdStr);

Ok when we run the above program, we get all text in uppercase, check the following output image.

Output

TypeScript, convert a string case to uppercase example
TypeScript, convert a string case to uppercase example

All the best đź‘Ť.