BjornRunow BjornRunow - 1 year ago 80
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!

Answer Source

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();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download