ichigyou
    Preparing search index...

    Function isSortedDescending

    • Checks if an array is sorted in descending order.

      Parameters

      • arr: number[]

        The input array of numbers.

      Returns boolean

      true if the array is sorted in descending order, otherwise false.

      const sortedArray = [5, 3, 2, 1];
      const isDescending = isSortedDescending(sortedArray);
      console.log(isDescending); // Output: true