Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
  <head>
    <title>Simple Map</title>
    <meta name="viewport" content="initial-scale=1.0">
    <meta charset="utf-8">
    <style>
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
      #map {
        height: 100%;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script>
      var map;
      function appendMarker(map, latitude, longitude, text) {
        var pos = {lat: latitude, lng: longitude};
        var markerOption = {
          position: pos,
          map: map,
          title: text || 'Hello World!'
        };
        return new google.maps.Marker(markerOption);
      }
      
      function initMap() {
        var myLatLng = {lat: -25.363, lng: 131.044};
        var myLatLng2 = {lat: -25.3639, lng: 131.0449};
        map = new google.maps.Map(document.getElementById('map'), {
          center: myLatLng,
          zoom: 15
        });
        appendMarker(map, -25.363, 131.044, 'Hello');
        appendMarker(map, -25.363 + 0.005, 131.044 + 0.005, 'Hello, im var2');
      }
      
    </script>
    <script src="https://maps.googleapis.com/maps/api/js?callback=initMap"
    async defer></script>
  </body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
yukioxDpro
0viewers