I've seen a few questions with similar topics, but most of them used arrays such as [1, 2, 3, 4, 5] for sorting, as opposed to what I need to use, which is [1, 1, 2, 1, 4], with the largest numbers coming first, and the zeroes removed.
Example:
[4, 3, 8, 0, 0] as the array to sort by, and ["hello", "my", "name", "is", "indigo"] as the array to be sorted.
This should be turned into:
["name", "hello", "my"]
because the zeroes are removed.
My main issue is that most methods I've tried end up assigning the values in one array to the numbers in another. Example:
[4, 1, 1, 4, 8] and ["hello", "my", "name", "is", "indigo"]
should return ["indigo", "is", "hello", "my", "name"], but returns ["indigo", "hello", "hello", "my", "my"], or something to that effect.