The following code works fine:
direction.route(
{
start: '30 Baker St, Old City, YY 12345',
end: '30 Bogus Address Ave, Fake, ZZ 12345',
waypoints: [ "<address1>", "<address2>" ] //Array using literals
});
The problem I'm having is that I may have dozens of addresses stored in an array. The number of addresses in the array will vary.
The following code would work, but I need to be able to build the array within th JS object dynamically.
direction.route(
{
start: '30 Baker St, Old City, YY 12345',
end: '30 Bogus Address Ave, Fake, ZZ 12345',
waypoints: [ address[0], address[1], address[2], ... ] //Array using variables
});