sort-the-array
v1.0.7
Published
sorting the array
Downloads
20
Maintainers
Readme
Installation
npm install sort-the-array --save-dev
Import
Example: test.cjs file extension
const { sortNumbers, sortStrings } = require('sort-the-array');
Usage
const numbers = [4, 2, 7, 1, 5];
const strings = ['banana', 'apple', 'orange', 'grape'];
console.log('Sorted numbers:', sortNumbers(numbers)); // Sorted numbers: [ 1, 2, 4, 5, 7 ]
console.log('Sorted strings:', sortStrings(strings)); // Sorted strings: [ 'apple', 'banana', 'grape', 'orange' ]