javascript - Remove line breaks/spaces from array -


i having trouble removing line breaks text in javascript. here example of data working with:

0: "christian pulisic" 1: "↵" 2: "from wikipedia, free encyclopedia" 3: "↵"  4: "christian pulisic" 5: "↵" 6: "personal information" 7: "↵" 8: "full name   christian mate pulisic[1]" 

obviously, line spaces/breaks or whatever call them, polluting data getting.

i cannot following function recognize line breaks , replace "" can remove array through function run data through.

this code using not working:

for (i in cleanarray){     cleanarray[i].replace(/(\r\n|\n|\r)/gm,"") };  console.log(cleanarray); 

cleanarray[i].replace(/(\r\n|\n|\r)/gm,"") return new string. furthermore, strings immutable in javascript. change

for(var = 0; < cleanarray.length; ++i)     cleanarray[i] = cleanarray[i].replace(/(\r\n|\n|\r)/gm,"") 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -