Sorting based Javascript program to find all elements in array which have atleast two greater elements itself .
function findElements ( arr , n ) { arr . sort ( ) ; for ( let i = 0 ; i < n - 2 ; i ++ ) document . write ( arr [ i ] + " " ) ; }