BjornRunow BjornRunow - 2 months ago 13x
Javascript Question

Convert array into upper case

I have an array that I want to change to upper case but I can´t make it work. Please help me.

var array2 = ["melon","banana","apple","orange","lemon"];


I have also tried the below but it doesn´t work neither.;

Thanks in advance!


you should use handler function in map:

var array2 = ["melon","banana","apple","orange","lemon"];{ return x.toUpperCase() })

for more information about map

edit: yes you can do

toUpper = function(x){ 
  return x.toUpperCase();