Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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;
}
Source by ujjaini.wordpress.com #
 
PREVIOUS NEXT
Tagged: #check #string #unique #characters #javascript
ADD COMMENT
Topic
Name
2+3 =