Hi
Return is used in javascript for two reasons.
You want the script to stop executing if something happens.
You want the function to return a value to the calling function.
Try
var newVar;
var heading =
google.maps.geometry.spherical.computeHeading(path[0],path[1]);
if (heading>0)
newVar = Math.round(heading);
else
newVar = Math.round(360-heading);
Or just use heading instead of newVar if appropriate
ie
var heading =
google.maps.geometry.spherical.computeHeading(path[0],path[1]);
if (heading>0)
heading = Math.round(heading);
else
heading = Math.round(360-heading);
Regards Davie