function isAscending(arr) {
if (arr.length < 2) return true;
let prev = arr[0];
for (let i = 1; i < arr.length; i++) {
if (arr[i] < prev) return false;
prev = arr[i];
}
return true;
}
isAscending([1,2,3,4,5]) // true
isAscending([1,2,1,4,5]) // false