I have multiple arrays. Lets take three for example: long, lati, and depth:
var long = [3, 4, 6, 5, 7, 8];
var lati = [2.2, 4.3, 0.5, 1.3, 2.3, 1.1];
var depth = [1, 5, 2, 6, 4, 3];
So depth of long (3) & lati (2.2) is '1'.
3 2.2 1
4 4.3 5
6 0.5 2
5 1.3 6
7 2.3 4
8 1.1 3
I want to sort depth, and based on that, long and lati should get sorted respectively. So final result should be:
var long = [3, 6, 8, 7, 4, 5];
var lati = [2.2, 0.5, 1.1, 2.3, 4.3, 1.3];
var depth = [1, 2, 3, 4, 5, 6];