Good day to all! I’m adding markers with lables from 0 to 9 to the map, no problems ...

doing it that way

var labels = '0123456789'; var labelIndex = 0; var marker = new google.maps.Marker({ position: location, label: labels[labelIndex++ % labels.length], map: map }); } 

Right now there is a need to make them up to 30. I tried to add but he does not read 2 tsr ... And ve also adds one by one

    1 answer 1

    Naturally. The integer division operation returns the character position in labels.

    Write like this

     label: (labelindex++).toString() , 
    • No, it did not help - elik
    • You made the conversion to the string, but vseravno he don `t know that 12 is not 1 and 2. - elik
    • and you can get rid of the array ??? - elik
    • I corrected the answer - KAGG Design
    • one
      by itself. your sample code just outputs tags from 0 to 9, if you need up to 10 tags. I transformed it to work with any number. Or you don’t need it at all, then bring here a complete fragment of the working code. - KAGG Design