所以我試圖用map()方法如下:JavaScript數組映射函數不會更改字符串中的元素嗎?
words = ["One", "Two"];
words = words.map(function(currentValue)
{
alert(currentValue[0]);//Output: O Then: T
currentValue[0] = "A";
alert(currentValue[0]);//Output: O Then: T
return currentValue;
});
爲什麼是CurrentValue的[0]是沒有得到分配值 「A」?!?
查看http://stackoverflow.com/questions/1431094/how-do-i-replace-a-character-at-a-particular-index-in-javascript – Peter 2014-12-09 12:58:05