我需要在for循环内的js中创建动态变量名
var counter = 0;
for(i=0; i<location.length; i++) {
...
var "marker_" + counter = new google.maps.Marker({
但是当我期望有变量 marker_0,marker_1,marker_2,... 我有这个错误
Error: SyntaxError: missing variable name
Source Code:
var "marker_" + counter = new google.maps.Marker({