Find one extra character in a string | Javascript program to find extra character in one string ; result store the result ; traverse string A till end and xor with res ; xor with res ; traverse string B till end and xor with res ; xor with res ; print result at the end ; given string
function findExtraCharcter ( strA , strB ) { let res = 0 ; for ( let i = 0 ; i < strA . length ; i ++ ) { res ^= strA . charCodeAt ( i ) ; } for ( let i = 0 ; i < strB . length ; i ++ ) { res ^= strB . charCodeAt ( i ) ; } return res ; } let strA = " " ; let strB = " " ; document . write ( String . fromCharCode ( findExtraCharcter ( strA , strB ) ) ) ;