pass string into object javascript
<p>I get the <code>id</code> of a <code>li</code> element and want to use the name to access that part of an object. I have tried to add the <code>var selectionId</code> which contains the name of the section I want, such as <code>cars</code> but i get an error. Is there a way?</p>

<p>Thanks.</p>

<pre><code>$(document).ready(function() {

    $(".markerSelection").click(function() {
      var selectionId = $(this).attr("id");
      drop(selectionId);
    }); 
});


var markers = {
    shopping : [
    new google.maps.LatLng(52.26183, -7.11339),
    new google.maps.LatLng(52.26134, -7.11226),
    new google.maps.LatLng(52.26067, -7.11181),
    new google.maps.LatLng(52.26003, -7.11033)],
    cars : [
    new google.maps.LatLng(52.26183, -7.11339),
    new google.maps.LatLng(52.26134, -7.11226),
    new google.maps.LatLng(52.26067, -7.11181),
    new google.maps.LatLng(52.26003, -7.11033)] 
};

var iterator = 0; 

function drop(selectionId) {
    clearOverlays();
    for (var i = 0; i &lt; markers.selectionId.length; i++) {
        setTimeout(function() {
            addMarker();
        }, i * 200);
    }
}
</code></pre>
