Print the constructed array
document . write ( " " ) ; for ( let i = 0 ; i < answer . length ; i ++ ) { if ( i == answer . length - 1 ) document . write ( answer [ i ] + " " ) ; else document . write ( answer [ i ] + " " ) ; } }