Javascript String ToLowerCase | JavaScript str.ToLowerCase()

Javascript String ToLowerCase | JavaScript str.ToLowerCase()

To convert string characters into the lower case in JavaScript; In this tutorial, you will learn about JavaScript string toLowerCase() method and how to convert string characters into lowercase using this method.

JavaScript String toLowerCase() is a built-in method that is used to convert string characters into lowercase.

Javascript String toLowerCase()

JavaScript str.toLowerCase() method converts the characters of a string into lower case characters.

Note that, this method does not affect any of the special characters, digits, and string characters that are already in lowercase.

The following syntax represents the string.toLowerCase() method:



  • a string which you want to convert into lowercase.
  • toLowerCase() is method, which is used to convert string characters into lowercase.

Let’s take a look at the example:

let str = 'A Quick Javascript Tutorial';
console.log(str.toLowerCase()); // output: a quick javascript tutorial

In this example, you can see all the uppercase string characters converted into lowercase with the help of javascript toLowerCase() method.

Javascript toLowerCase() array

How to convert a string to lowercase which is stored in an array?. You can see the following example:

let arr = [






let str = arr.join('~').toLowerCase()

let newArr = str.split('~')

console.log(newArr) //Output:  ["javascript", "php", "mysql", "sql"]

In this example, we have used Javascript join() method the mixed-case array into a string, after that use toLowerCase() to convert the string into lowercase. And Javascript split() the string back into an array.

TypeError: Cannot read property ‘toLowerCase’ of undefined

In case, you pass the undefined string into toLowerCase() method and then you will get some error. The error looks like this: TypeError: Cannot read property ‘toLowerCase’ of undefined.

The following example:

let str = undefined

let res = str.toLowerCase();

console.log(res) // TypeError: Cannot read property ‘toLowerCase’ of undefined.

Recommended JavaScript Tutorials


Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *