[SOLVED] Array descending | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
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