Hello. 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 ?
Thanks.
Hello. 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 ?
Thanks.
Sure -- just iterate through the array and do a standard removal on each iteration.
Or if the nature of your array permits, you could first convert the array to a string, take out the commas, then convert back into an array.
Given the required string in variable s :-
var result = s.replace(/,/g, '');
Yes.
for(var i=0; i < arr.length; i++) {
arr[i] = arr[i].replace(/,/g, '');
}