count elements which occur more than once
for ( let [ key , value ] of m . entries ( ) ) { if ( value > 1 ) { if ( value >= 4 && value % 2 == 0 ) check ++ ; count ++ ; } } let flag ; if ( check % 2 != 0 ) flag = false ; if ( check % 2 != 0 ) document . write ( " " ) ; else if ( n % 2 == 0 && count % 2 == 0 ) document . write ( " " ) ; else document . write ( " " ) ; }