Tryit Editor v1.8

Source Code:
<!DOCTYPE html> <html> <head> <script src="../../maps.googleapis.com/maps/api/jskeyaizasydy0kkjitpvd2u7atoawhc9ysh6ohxoiymsensorfalse"> </script> <script> var map; function initialize() { var mapOpt = { center:new google.maps.LatLng(51.508742,-0.120850), zoom:6, mapTypeId:google.maps.MapTypeId.ROADMAP }; map=new google.maps.Map(document.getElementById("googleMap"),mapOpt); } google.maps.event.addDomListener(window, 'load',initialize); </script> </head> <body> <button onclick="alert(map.getZoom());">Get Zoom</button> <br><br> <div id="googleMap"style="width:400px;height:300px;"></div> </body> </html>
Result:
W3Schools.com - Try it yourself