How do I remove the space between words in an array using Javascript?
5 answers
You can use a function array.map
to loop through an array and use regex to remove all the space:
var array = ['FLAT RATE', 'FREE SHIPPING'];
var nospace_array = array.map(function(item){
return item.replace(/\s+/g,'');
})
console.log(nospace_array)
+3
source to share