// sort():- sort an array into an according to the some function
// array.sort(function())
const arr=[2,4,1,8,2,3];
console.log(arr);
arr.sort(function (a,b){
return a-b
})
console.log(arr);//printing array in ascending order
let n = arr.sort(function (a,b){
return b-a;
})
console.log(n)//printing array in descending order