Bootstrap FreeKB - NodeJS - Upper Lower Case using toUpperCase toLowerCase
NodeJS - Upper Lower Case using toUpperCase toLowerCase

Updated:   |  NodeJS articles

toUpperCase can be used to make a string or variable upper case. In this example, "Hello World" will become "HELLO WORLD".

const my_string = "Hello World";
console.log(my_string.toUpperCase());

 

lower can be used to make a string or variable lower case. In this example, "Hello World" will become "hello world".

const my_string = "Hello World";
console.log(my_string.toLowerCase());

 

Here is an example with an if statement.

const my_string = "Hello World";

console.log(my_string.toLowerCase());

if (my_string.toLowerCase().includes('hello')) {
  console.log("my_string includes hello");
} else {
  console.log("my_string does NOT include hello");
}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 633677 in the box below so that we can be sure you are a human.