title: How to "generate" unique variables?
body: <p>I'm currently working on a Google Map, and now I want to "generate" pins from an API. But then I get stuck, because a pin looks like this:</p>
  
  <pre><code>var imageDriver = 'marker.png';
  var DriverLatLng = new google.maps.LatLng(location.lat, location.lng);
  var driverMarker = new google.maps.Marker({
      position: DriverLatLng,
      map: map,
      icon: imageDriver,
      title: drivers[0].name
  });
  }
  </code></pre>
  
  <p>I want to create a function of some sort that could "generate" these variables with a prefix. Check an example below:</p>
  
  <pre><code>var imageDriver0;
  var DriverLatLng0;
  var driverMarker0;
  position: DriverLatLng0,
  map: map,
  icon: imageDriver0,
  title: drivers[o].name
  </code></pre>
  
  <p>These variables must be unique of course so they don't "collide". I have this for-loop that counts all "drivers" inside my API. Could I somehow make this for-loop to create these pins?
  Example:</p>
  
  <pre><code>    driversRealtime();
  function driversRealtime() {
      setInterval(function () {
          var url = "http://blackcab.didair.se/api/drivers";
          var lat;
          var lon;
          var name;
          var id;
          $.getJSON(url,
  
          function (response) {
              for (var i = 0; i &lt; response.drivers.length; i++) //Counts data-elemements inside 
                  lat = response.drivers[i].currentLat;
                  lon = response.drivers[i].currentLon;
                  name = response.drivers[i].name;
                  id = response.drivers[i].profileId;
              console.log(lat);
              console.log(lon);
              console.log(name);
              console.log(id);
          });
      }, 3000); //Delay in milliseconds
  }
  </code></pre>