JavaScript 字符串分割后去除空格并去重
🏷️ JavaScript
javascript
Array.from(
new Set(
"1, , 1,"
.split(",")
.map(v => v.trim())
.filter(v => !!v)
)
)
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8