JavaScript version
sort.js
const sort = (arr) => arr.sort((a, b) => a - b);
TypeScript version
sort.ts
const sort = (arr: number[]): number[] => arr.sort((a, b) => a - b);
Example
example.js
sort([1, 5, 2, 4, 3]); // [1, 2, 3, 4, 5]
const sort = (arr) => arr.sort((a, b) => a - b);
const sort = (arr: number[]): number[] => arr.sort((a, b) => a - b);
sort([1, 5, 2, 4, 3]); // [1, 2, 3, 4, 5]