Check whether sum is equal to target if it is equal , then print the subset
if ( sum == target ) { document . write ( " " ) ; for ( let i = 0 ; i < set . length ; i ++ ) if ( x [ i ] == 1 ) document . write ( set [ i ] + " " ) ; document . write ( " " ) ; } }