文字列のチェックと重複排除

文字列のチェックと重複排除

function fn(str) {
    
    
    // 去重
    for (let i = 0; i < str.length; i++) {
    
    
        if (str.indexOf(str[i]) !== str.lastIndexOf(str[i])) {
    
    
            str = str.replace(str[i], "");
        }
    }
    console.log(str)
}

おすすめ

転載: blog.csdn.net/weixin_44523860/article/details/115206298