// for copy array and object we use ...(spread operator in js) const rating = [4,3,5,2] const descRating = [...ratings] descRating.sort((a,b)=> b-a) //for ascending use a-b