I have two arrays and the data is merged, for example: [maximilian, moritz, hans] and [5,1,2000]
Now I need to sort the first array based on the length of the names and store the numbers in the right place. The result should be: [Chickens, Moritz, Maximilian] [2000,1,5]
You can usually combine both arrays, sort them, and then split. Simply. But in my case, the numbers have different lengths, so the correct order is not guaranteed. If I combine and sort, the result will be: [Moritz, chickens, Maximilian] [1,2000,5] and this is wrong. Anyone have an idea how to fix this?
source
share