Convert array elements to Uppercase or Lowercase in JavaScript

This tutorial will show you how to convert array elements to Uppercase or Lowercase in JavaScript.

Convert all array elements to uppercase:

  • To transform each element of the array use the map()¬†method.
  • Use the string method toUpperCase() along with an array map() method to convert all the array values in uppercase.
let codespeedy = ["samim",  "saruque", "faruque"];
let uppercase = => element.toUpperCase());


0: "SAMIM"

Convert all JavaScript array elements to lowercase:

  • Now you can use the string method toLowerCase()¬† to convert all the array values into lowercase.
let codespeedy = ["SAMIM", "SARUQUE", "FARUQUE"]
let lowercase = => element.toLowerCase());


0: "samim"
1: "saruque"
2: "faruque"


So we have seen how both of these methods actually work. But here are a few points about these methods that might help you in the future to deal with string operations:

  • Both of these methods toLowerCase() and toUpperCase(), does not take parameters or arguments.
  • These methods work upon string only.
  • These can only return the converted string but do not modify the variables’ actual value.

Leave a Reply

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