function compareFunction(a, b) {
return a - b;
}
const num = [4, 1, 63, 8, 5, 100, 9, 75];
console.log('Before');
console.log(num);
const sort3 = num.sort(compareFunction);
console.log(`\n----------------------------------------------\n`);
console.log(`returns element: ${sort3}`);
console.log('\nAfter');
console.log(num);
This Pen doesn't use any external CSS resources.