Program to check if all characters have even frequency | JavaScript implementation of the above approach ; creating a frequency array ; Finding length of s ; counting frequency of all characters ; checking if any odd frequency is there or not ; Driver Code
function check ( s ) { var freq = Array ( 26 ) . fill ( 0 ) ; var n = s . length ; for ( var i = 0 ; i < s . length ; i ++ ) freq [ s [ i ] - 97 ] ++ ; for ( var i = 0 ; i < 26 ; i ++ ) if ( freq [ i ] % 2 == 1 ) return false ; return true ; } var s = " " ; check ( s ) ? document . write ( " " ) : document . write ( " " ) ;