我很感兴趣,如果有任何函数,如来自php的array_map或array_walk.
不需要为所有阵列旅行.我可以为自己做到这一点.
var array = ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'];
// i would like something like this if exists - function(array, 'upperCase');
Run Code Online (Sandbox Code Playgroud) 是否有一种非向后的方法将一个数组索引转换为大写字符串?我不想拆分,循环或其他任何东西,因为我只需要这一个字符串.
colors = [ "red", "green", "blue" ];
red = colors[0];
redUpper = red.toUppercase();
Run Code Online (Sandbox Code Playgroud)
这不起作用,因为它toUppercase()是一个字符串函数.我知道.我只是在寻找实现这一目标的最简单方法.