text: Find all elements in array which have at | Sorting based Javascript program to find all elements in array which have atleast two greater elements itself . ; Driver code
code: function findElements ( arr , n ) { arr . sort ( ) ; for ( let i = 0 ; i < n - 2 ; i ++ ) document . write ( arr [ i ] + " " ) ; } let arr = [ 2 , - 6 , 3 , 5 , 1 ] ; let n = arr . length ; findElements ( arr , n ) ;