I have an array which includes some numbers and i wanna sort them by value. For example imagine i have this array:
let myArray = [ 10 , 50 , 30 , 20 , 40]
I wanna sort them by the value from biggest to smallest with for loop or if/else or anything else which i can get result like that:
myArray = [ 50 , 40 , 30 , 20 , 10 ]
or maybe check values and input them in a new array :
newArray = [ 50 , 40 , 30 , 20 , 10 ]
It looks simple but i can't do it,Thanks