Skip to content
Advertisement

Sort a list in a list by numbers

I am in the process of creating a bot that will compare the price of many items. In the list I have the price with some other information. However, I would like to sort e.g. this list

JavaScript

by the price, so it looks like this list

JavaScript

But I have no clue how i can manage this, maybe one of you guys can help me

Advertisement

Answer

You can custom sort via lambda:

JavaScript

Please note that your current format is not ideal, because you are mixing the data. You could consider using a dictionary like this:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement