Sort the integers array and set the index of smallest and largest element
( integers ) . sort ( function ( a , b ) { return a - b ; } ) ; let lowerIndex = 0 ; let higherIndex = integers . length - 1 ; let sb = " " ;