If yes , prlet it and all subsequent occurrences
document . write ( arr [ i ] + " " ) ; for ( let j = i + 1 ; j < n ; j ++ ) { if ( arr [ i ] == arr [ j ] ) { document . write ( arr [ i ] + " " ) ; visited [ j ] = true ; } } } } }