I am using google maps api to display some points on a map. I need each marker to appear on the map with different icon depending on its type. For example houses a red dot and stores a blue dot. The type is pointed out by a variable “exacttype” .
Right now there is a variable var icon that includes the path like this icon.image='....apath/iconred.png';
How can i include this variable in the icons path so i wont need to create a different icon variable? something like this : icon.image='...apth/icon"exacttype".png;
The reason i am doing this is i already have 2 types of icons A and B but lets say icons A do need to differentiate from eachother according to their details.
I am using google maps api to display some points on a map. I
Share
How about this:
In other word, you replace ‘icon’ and all non-dot symbols that follow it with concatenation of ‘icon’ and that string stored in
exacttypevariable. It could be made even more concise with help of look-behind expression/(?<=icon)[^.]+(?=[.]png)/, but JS does not support it.