[SOLVED] Array descending | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

[SOLVED] Array descending

Why is the array.sort() descending not having an output in this code after the button click? https://code.sololearn.com/W0v9HbJ8okP5/?ref=app

27th Aug 2018, 1:27 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
5 Answers
27th Aug 2018, 2:12 PM
Vojtěch Novák
Vojtěch Novák - avatar
+ 1
Worked to change the reverse().sort() to sort().reverse() Thanks for the help👍 https://code.sololearn.com/W0v9HbJ8okP5/?ref=app
27th Aug 2018, 2:19 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
0
Are you want to sort array by alphabet and reverse or do you want only reverse array? In first case use .sort() (without parameters) and then .reverse() method. In second case use only .reverse()
27th Aug 2018, 1:56 PM
Vojtěch Novák
Vojtěch Novák - avatar
0
alphabetic and reverse. What i did here in this code but then the opposite way https://code.sololearn.com/WY1B3dmDwRiS/?ref=app
27th Aug 2018, 1:58 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
0
I see, but its still ascending instead of descending the output.
27th Aug 2018, 2:17 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar