Determine if a string has all Unique Characters | Javascript program to illustrate string with unique characters using brute force technique ; If at any time we encounter 2 same characters , return false ; If no duplicate characters encountered , return true ; Driver code
function uniqueCharacters ( str ) { for ( let i = 0 ; i < str . length ; i ++ ) for ( let j = i + 1 ; j < str . length ; j ++ ) if ( str [ i ] == str [ j ] ) return false ; return true ; } let input = " " ; if ( uniqueCharacters ( input ) == true ) document . write ( " " + input + " " + " " ) ; else document . write ( " " + input + " " ) ;