Contact: aviboots(AT)netvision.net.il
39,870 questions
51,793 answers
573 users
let arr: number[] = [1000, 10, 100, 10000, -8, 100000, 1]; arr.sort(function(a: number, b: number) { return a - b; }); console.log(arr); /* run: [-8, 1, 10, 100, 1000, 10000, 100000] */
let arr: number[] = [1000, 10, 100, 10000, -8, 100000, 1]; arr = arr.sort((a, b) => a - b); console.log(arr); /* run: [-8, 1, 10, 100, 1000, 10000, 100000] */