I'm attempting to change the zoom level of my google map based on user input.

```
<script type="text/javascript">

    var map;

    function initMap() {    
    var uluru = {lat: 37.7749, lng: -122.4194};    
    var map = new google.maps.Map(document.getElementById('map'), {    
    zoom: 10,    

       // standard google map javascript

    } //end of initMap() 

    $('#id_zoomlevel').on('change', function() {
       var zoomlevel = $('#id_zoomlevel :selected').attr('value');
       map.setZoom(zoomlevel);
    });

</script>

```

I'm getting the following error:

```
(index):679 Uncaught TypeError: Cannot read property 'setZoom' of undefined

```

How do I pass the now set map variable into to 'on change' function?