I have this 2d Array in JavaScript:
['Daniela', 'Jonas', 'Simon', 'Vincent']
['0', '3', '0', '4']
in which the numbers stand for the amount of guesses the user took to guess a random number. and i want it to look like this:
['Jonas', 'Vincent', 'Simon', 'Daniela']
['3', '4', '0', '0']
so basically, sorted by the numbers from lowest to highest (except 0 since the user didnt finish his run), but the names sorted accordingly to the numbers.
How (if) is this possible?
I tried sorting it like normally like a 2d Array and it didnt work, i tried splitting the different array and sorting them manually but then i dont know how to sort them connectively.