Answers for "javascript string unique characters"

4

javascript string unique characters

const unique = (str) => {
	const cleanStr = str.replace(/ /gi, '');
    const set = [...new Set(cleanStr)];

    return set;
}

console.log(unique('asdqwe asdqwet dfadqwre  '));
Posted by: Guest on October-26-2021
0

check a string for unique characters javascript

function checkForUnique(str){
    var hashtable = {};
    for(var i=0,len=str.length;i<len;i++){
        if (hashtable[str[i]] != null){
            hashtable[str[i]] = 1;
            return false;
        }else{
            hashtable[str[i]] = 0;
        }
    }
    return true;
}
Posted by: Guest on September-04-2020

Code answers related to "javascript string unique characters"

Code answers related to "Javascript"

Browse Popular Code Answers by Language