For string to be isomorphic the previous counts of appearances of current character in both string must be same if it is not same we return false .
if ( countChars1 [ str1 [ i ] . charCodeAt ( ) - ' ' ] != countChars2 [ str2 [ i ] . charCodeAt ( ) - ' ' ] ) { return false ; } } return true ; }