Determine if a string has all Unique Characters | Function program to illustrate String with unique characters ; Converting string to set ; If length of set is equal to len of string then it will have unique characters ; Driver Code
function uniqueCharacters ( str ) { var setstring = new Set ( str ) if ( setstring . size == str . length ) { return true } else { return false } } var input = " " if ( uniqueCharacters ( input ) ) { document . write ( " " + input + " " ) ; } else { document . write ( " " + input + " " ) }