I am setting the trackPath.setMapth(null); that is clearing the polyline overlay on the map , it is executing at the end of the function I have added here.
Here cosole.log(see the function) is being printed first then the trackPath.setMap(null) is clearing.
function play(id, value) {
  clearTimeout(timerForTrack);
  trackPath.setMap(null);
  trackPath = null; // removing this line too makes the same thing
console.log("this is coming first than clearing the track");
  // some commented code
}
I have been working on this work 4 hours. The issue is I need to add a new polyline after clearing that.Any ideas where I am going wrong.
