let newArr=b.filter(i=>i && i.trim()) console.log("数组b",newArr);
trim()⽤于去掉字符串⾸尾空⽩字符。filter() ⽤于把arr的某些元素过滤掉,然后返回剩下的元素。字符串转成数组问题的具体步骤:// var b=[];var treeSelectData=$("#treeSelectData").val()var b=treeSelectData.split(";")console.log('数组b', b);let newArr=b.filter(i=>i && i.trim()...