Array Is Sorted

# Introduction In this lab, we will be working with the `isSorted` function in JavaScript to determine whether a numeric array is sorted in ascending or descending order. We will use the `Math.sign()` method to convert the final direction value to `-1` for descending order and `1` for ascending order. We will also handle cases where the array is empty, has only one element, or the direction changes for any pair of adjacent array elements.

|60 : 00

Click the virtual machine below to start practicing