bounds viewport
MA | Maine | Main st | 1 Main st | USA | Europe
It constructs a rectangular instance of Polygon. 'bounds' option defines the position and dimensions.
V3 geocoder returns geometry.viewport and geometry.bounds as LatLngBounds objects. Targets without bounds, like street numbers, return geometry.viewport only. Rectangle is used for visualizing those.
while(overlays[0]){
overlays.pop().setMap(null);
}
All the polygons are pushed to overlays array. There could be markers too.
pop() method returns the last element of an array.
It also removes that from the array.
So that while-loop removes the overlays both from the map and from the array.