Program to find the XOR of ASCII values of characters in a string | Function to find the XOR of ASCII value of characters in string ; store value of first character ; Traverse string to find the XOR ; Return the XOR ; Driver code
function XorAscii ( str , len ) { let ans = str . codePointAt ( 0 ) ; for ( let i = 1 ; i < len ; i ++ ) { ans = ( ans ^ ( str . codePointAt ( i ) ) ) ; } return ans ; } let str = " " ; let len = str . length ; document . write ( XorAscii ( str , len ) + " " ) ; str = " " ; len = str . length ; document . write ( XorAscii ( str , len ) ) ;