check if a string has unique characters javascript code example
Example: 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;
}