number_sorting
v1.0.3
Published
## Installation
Downloads
6
Maintainers
Readme
Number Sorting
Installation
Install via NPM
npm install number_sorting
Install via YARN
yarn add number_sorting
Description
- This package sorts an array of numbers in ascending or descending order.
- It also finds smallest and greatest number from an array of numbers.
Usage
const sorting = require('number_sorting');
const array_of_number = [ 1, 2, 5, 4, 7, 6];
const ascending = sorting.ascending_sorting(array_of_number); // to sort in ascending order
const descending = sorting.descending_sorting(array_of_number); // to sort in descending order
const smallest = sorting.smallest_number(array_of_number); // to find smallest number
const greatest = sorting.greatest_number(array_of_number); // to find greatest number
console.log(ascending) // [ 7, 6, 5, 4, 2, 1 ]
console.log(descending) // [ 1, 2, 4, 5, 6, 7 ]
console.log(smallest) // 1
console.log(greatest) // 7