Skip to content Skip to sidebar Skip to footer

Global Variable 'map' Is Undefined

I have a global variable, map, declared after the opening script tag - I also have a global variable, test_var, declared right underneath. In the initialize function, I use the goo

Solution 1:

This is because your event handler (function initialize) is not yet called when you call console.log(map). Try adding console.log(map) to a button

<input type=button onclick="console.log(map)" value="Test map" />

Post a Comment for "Global Variable 'map' Is Undefined"