NodeJS - Upper Lower Case using toUpperCase toLowerCase
by
Jeremy Canfield |
Updated: April 01 2024
| 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