Created
January 31, 2023 08:37
-
-
Save rameshbaskar/a0b5fcaa11d5c64c04219be55a58e991 to your computer and use it in GitHub Desktop.
Simple array sorting in Javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sortArray(arr) { | |
return arr.sort((a, b) => a - b); | |
} | |
const arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]; | |
console.log(sortArray(arr)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment