Program to find the minimum ( or maximum ) element of an array | Javascript program to find minimum ( or maximum ) element in an array . ; Driver code
function getMin ( arr , n ) { return Math . min . apply ( Math , arr ) ; } function getMax ( arr , n ) { return Math . max . apply ( Math , arr ) ; } var arr = [ 12 , 1234 , 45 , 67 , 1 ] ; var n = arr . length ; document . write ( " " + getMin ( arr , n ) + " " ) ; document . write ( " " + getMax ( arr , n ) ) ;