symfony - How to concatenate a Twig variable in Javascript -
i have twig template contains javascript code. in control pass array template. i'm using javascript display map using google maps api javascript . created variable incremented @ each loop round when creating markers. variable want use variable access each element of table according given index. since array in twig, index in javascript. concatenation seems complicated. here's line concerned question : infowindow.setcontent('<div><strong>{{ services['+j+']["name"] }}</strong><br>'); and here' full example: var j = 0; var markers = locations.map(function(location, i) { var marker = new google.maps.marker({ position: location }); service.getdetails( { placeid: 'chijn1t_tdeuemsrusoyg83fry4' }, function(place, status) { google.maps.event.addlistener(marker, 'click', function() { infowindow.setcontent('<div><strong>{{ servic...