UNDERTAKE ONLY IF YOU WORKED WITH DISTANCE MATRIX API
AND YOU ARE A GURU OF PROMISES, ASYNC-WAIT OPERATIONS
We have a bunch of addresses in an array. We would like to measure the distance among all the origin and destination addresses, so in every possible variations without duplicates.
The problem: the callback function runs on a very different speed, and when we got back data from the callback function, we did not know which response belongs to which query.
We are using IDs to identify the address (startID and endID), but we can not pass that to the callback function, so we loose track: we don't know which distance data belongs to what.
The mission is to push the IDs through the whole process so that we can know which measurement we are getting back.
A good solution here would be async-wait functions and promises but that is high for me.
On the top of the problem we are getting the "Can not read property "value" of undefined. We did not get this error before, this code was giving back distance data.