Skip to content

JavaScript 字符串分割后去除空格并去重

🏷️ JavaScript

javascript
Array.from(
    new Set(
        "1, , 1,"
        .split(",")
        .map(v => v.trim())
        .filter(v => !!v)
    )
)