Hi I have this simple function in JS for google maps and I get uncaught typeerror
directionResult is google directions response object which is passed by other function to this function.
var myRoute = directionResult.routes[0].legs[0];
var warnings = document.getElementById("warnings_panel");
for (var i=0;i<3;i++)
{
warnings.innerHTML += "<br/><br/>start lat = " + myRoute.steps[i].start_location.lat() +
"start lng = " + myRoute.steps[i].start_location.lng() + "<br />";
warnings.innerHTML += "end lat = " + myRoute.steps[i].end_location.lat() +
"end lng = " + myRoute.steps[i].end_location.lng() + "<br /> + Path :";
for(var path=0;path<myRoute.steps[i].path.length;path++)
warnings.innerHTML += myRoute.steps[i].path[path];
}//
Hard to tell without more information but I would check that the myRoute.steps array contains at least three elements.