Google Maps Api 3: Uncaught TypeError: Cannot call method 'setCenter' of undefined

13,379

map is not in scope. You declare map twice – once in the global scope and once in initialize, but you only set the map in initialize (the global map is shadowed).

Remove the var from var map = new google.maps.Map(...); (but not the var map; at the top).

Share:
13,379
Mike Averto
Author by

Mike Averto

ChannelApe

Updated on June 15, 2022

Comments