JavaScript dividir e acabar
var arr = str.split(",").map(item => item.trim());
Lazy Loris
var arr = str.split(",").map(item => item.trim());
var str = " Some text ";
str.trim();
// str = "Some text"
var str = " Hello World! ";
alert(str.trim());
value = value.trim();
var str=" I have outer spaces ";
var cleanStr=str.trim();//trim() returns string with outer spaces removed
var str = '/var/www/site/Brand new document.docx';
document.write( str.replace(/\s/g, '') );