替换javascript数组中的字符串 [英] Replace string in javascript array
本文介绍了替换javascript数组中的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在javascript中有一个数组。此数组包含逗号(,)的字符串。我希望从这个数组中删除所有逗号。可以这样做吗?
I have an array in javascript. This array has strings that contains commas (","). I want all commas to be removed from this array. Can this be done?
推荐答案
是。
for(var i=0; i < arr.length; i++) {
arr[i] = arr[i].replace(/,/g, '');
}
这篇关于替换javascript数组中的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文