how to use .split and trim together in js code example Example: javascript split and trim var arr = str.split(",").map(item => item.trim());