A blog for technology, SEO tips, website development and open source programming.

How to convert all Array values to LowerCase in JavaScript or with lodash

0 1,630

You can also now achieve this very simply by using an arrow function and the map() method of the Array:

var words = ['Foo','Bar','Fizz','Buzz'].map(v => v.toLowerCase());
console.log(words);

Note that map() will only work in browsers which support ES2015. In other words, anything except IE8 and lower.

If you want to use lodash library you can do the following:

var words = ['Foo','Bar','Fizz','Buzz']
var result = map(words, (v) => lowerCase(v))
console.log(result);

Follow me on Instagram

😉  That’s it for now. 

If you liked this article, then please subscribe to my YouTube Channel for video tutorials.

You can also find me on Twitter and Facebook.

Leave a Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More