Checks whether an array is in ascending order (allowing equal neighbouring values).
Array of numbers to compare pairwise.
true when each element is greater than or equal to the previous; arrays of length 0 or 1 always pass.
true
isAscending([1, 1, 2, 3]); // trueisAscending([3, 2, 1]); // falseisAscending([]); // true (0- and 1-element arrays pass) Copy
isAscending([1, 1, 2, 3]); // trueisAscending([3, 2, 1]); // falseisAscending([]); // true (0- and 1-element arrays pass)
Checks whether an array is in ascending order (allowing equal neighbouring values).