function for sort
How I solve a task??
const sort = (array) => {}
const arr = [1,7,8,54,23,2,14,6];
const result = sort(arr);
console.log(result)
//1,2,6,7,814,23,54
How I solve a task??
const sort = (array) => {}
const arr = [1,7,8,54,23,2,14,6];
const result = sort(arr);
console.log(result)
//1,2,6,7,814,23,54
const sort = (array) => array.sort((a, b) => a - b);
const arr = [1,7,8,54,23,2,14,6];
const result = sort(arr);
console.log(result)
PS: but pay attention that arr will be sorted too, and result will be just pointer to arr.
Thanks)