Using String toLowerCase() method to coding in Javascript/JS

This JavaScript tutorial explains how to use the string approach called toLowerCase() with syntax and examples.

Description

In JavaScript, toLowerCase() is a string approach that is used to convert a string to lowercase. Because the toLowerCase() method is a technique of the String object, it ought to be invoked through a specific instance of the String class.

Syntax

In JavaScript, the syntax for the toLowerCase() method is:

string.toLowerCase();

Parameters or Arguments

There are no parameters or arguments for the toLowerCase() method.

Returns

The toLowerCase() technique returns a string transformed to lowercase.

Note

The toLowerCase() method does not alternate the price of the authentic string.

Example

Let’s take a look at an instance of how to use the toLowerCase() method in JavaScript.

For example:

var totn_string = 'TechOnTheNet';

console.log(totn_string.toLowerCase());

In this example, we have declared a variable known as totn_string that is assigned the string value of ‘TechOnTheNet’. We have then invoked the toLowerCase() approach of the totn_string variable to convert the string to lowercase.

We have written the output of the toLowerCase() technique to the web browser console log, for demonstration purposes, to exhibit what the toLowerCase() method returns.

The following will be output to the net browser console log:

techonthenet

In this example, the toLowerCase() method converted the string ‘TechOnTheNet’ to lowercase and again a string fee of ‘techonthenet’.