3liYusuf / js-objects-lab

0 stars 0 forks source link

Sort by descending order, not ascending #4

Open KhalilKhunji opened 1 month ago

KhalilKhunji commented 1 month ago

https://github.com/3liYusuf/js-objects-lab/blob/27bc3d2301bd3029c9d81608b81de9a5647c6b91/app.js#L274

Here you are sorting by ascending order (i.e. lowest to highest hp) when the question asked for descending order (i.e. highest to lowest hp), so this should be:

game.party.sort((a, b) => b.hp - a.hp);
3liYusuf commented 1 month ago

Oh! I didn't notice that, thank you so much.