const unique = (str) => {
const cleanStr = str.replace(/ /gi, '');
const set = [...new Set(cleanStr)];
return set;
}
console.log(unique('asdqwe asdqwet dfadqwre '));
const uid = () => {
return Date.now().toString(36) + Math.random().toString(36).substr(2);
};
// Usage. Example, id = khhry2hb7uip12rj2iu
const id = uid();
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;
}
const uniq = (str) => {
console.log(([...new Set(str)]).join(''))
}
uniq('hello')