Checks whether an array is in descending order (allowing equal neighbouring values).
Array of numbers to compare pairwise.
true when each element is less than or equal to the previous; arrays of length 0 or 1 always pass.
true
isDescending([3, 3, 2, 1]); // trueisDescending([1, 2, 3]); // falseisDescending([42]); // true (single-element arrays pass) Copy
isDescending([3, 3, 2, 1]); // trueisDescending([1, 2, 3]); // falseisDescending([42]); // true (single-element arrays pass)
Checks whether an array is in descending order (allowing equal neighbouring values).