Hi Friends đź‘‹,

Welcome to Infinitbility ❤️!

Today, I’m going to show you how to convert string to lowercase in typescript, here we will use the javascript toLowerCase() method to convert to lowercase.

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

Let’s start coding…

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

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

console.log(firstStr, secondStr, thirdStr);

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

Output

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

All the best đź‘Ť.