I am working on a function that takes an array of numbers as input. The aim is to determine if the array is in ascending order and return true if it is, otherwise return false.
arr = [2, 10, 99, 150]
function checkOrder(arr) {
let sortedArray = arr.sort((a, b) => (a - b));
if (arr === sortedArray) {
return true
}
}