Generation

generate functionSun, 13 Nov 2022

Sort an array of numbers in ascending order

const sortArray = (array: number[]):number[] => { return array.sort((a, b) => a - b); // or // return array.sort((a, b) => b - a); }

TypeScript
Generate More

Questions about programming?Chat with your personal AI assistant