Hamming Distance between two strings | function to calculate Hamming distance ; driver code ; function call
function hammingDist ( str1 , str2 ) { let i = 0 , count = 0 ; while ( i < str1 . length ) { if ( str1 [ i ] != str2 [ i ] ) count ++ ; i ++ ; } return count ; } let str1 = " " ; let str2 = " " ; document . write ( hammingDist ( str1 , str2 ) ) ;