toUpperCase, toLowerCase

Changing string case.

Examples

To Upper Case

Converting string to all uppercase.

let text1 = "Hello World!";
let text2 = text1.toUpperCase();
console.log(text2); // "HELLO WORLD!"

To Lower Case

Converting string to all lowercase.

let text1 = "Hello World!";
let text2 = text1.toLowerCase();
console.log(text2); // "hello world!"

Case Insensitive Check

Normalizing strings for comparison.

let s1 = "JavaScript";
let s2 = "javascript";
console.log(s1.toLowerCase() === s2.toLowerCase()); // true

Test Your Knowledge

JavaScript Quiz

No quiz available for this topic yet.