# sx-is-sorted **Repository Path**: phpcoder/sx-is-sorted ## Basic Information - **Project Name**: sx-is-sorted - **Description**: 数组中number元素是否由小到大或者由大到小 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-12-20 - **Last Updated**: 2021-12-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # sx-is-sorted #### 介绍 判断number[]数组中元素是由小到大或者是由大到小 #### 安装教程 1. npm i sx-is-sorted 2. import sxIsSorted from "sx-is-sorted" #### 使用说明 ``` javascript import sxIsSorted from "sx-is-sorted"; // 第一个参数number[],第二个参数默认为true,数组中元素是否由小到大 console.log(sxIsSorted([1, 2, 3, 4, 5])); // 返回 true console.log(sxIsSorted([1, 2, 3, 5, 4])); // 返回 false // 第一个参数number[],第二个参数为false,数组中元素是否由大到小 console.log(sxIsSorted([5, 4, 3, 2, 1], false)); // 返回 true console.log(sxIsSorted([4, 5, 3, 2, 1], false)); // 返回 false ```