Here are two ways to convert an array to lowercase in JavaScript:
- Using toLowerCase() and map() methods
- Using an iteration
Method 1: Using the toLowerCase() with map()
The easiest way to convert all elements of an array to lowercase is to iterate over the array and call “.toLowerCase()” on each element using the “map()” method.
const originalArray = ['BMW', 'AUDI', 'MERCEDEZ', 'JAGUAR'];
const lowercaseArray = originalArray.map(item => item.toLowerCase());
console.log(lowercaseArray);
Output
[ 'bmw', 'audi', 'mercedez', 'jaguar' ]
In this code, we have an array called originalArray that contains strings in uppercase.
In the next step, we used the “map()” method to iterate through each array element and applied the “toLowerCase()” method to convert each string to lowercase.
The result is a new array called lowercaseArray containing the lowercase versions of the original strings.
We used an “arrow function” to simplify the callback function passed to the “map()” method. The result is the same as in the previous example.
Using an iteration
If you have an array of strings and you want to convert each string to lowercase, you can use a loop to iterate over each element, convert it to lowercase using the .toLowerCase() method (assuming this is in JavaScript), and then add the result to a new array.
let originalArray = ['BMW', 'AUDI', 'MERCEDEZ', 'JAGUAR'];
let lowercasedArray = [];
for (let i = 0; i < originalArray.length; i++) {
lowercasedArray.push(originalArray[i].toLowerCase());
}
console.log(lowercasedArray);
Output
['bmw', 'audi', 'mercedez', 'jaguar']

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.