const checkMonotonic = function (array){ if(array.length ===0){ return true } const first = array[0]; const last = array[array.length-1]; // 1.......10 if(first === last){ for(let i=0;iarray[i]) return false; } } return true; } checkMonotonic([9]);