Javascript 1D and 2D arrays with string indecies and .push()?
I'm working on a Google Maps Javascript API program and am having some trouble setting up arrays as I had intended.
Context:
When the map is initialized, a Geojson file is read and from its info a bunch of Markers (red pins) are created. Once created, these markers are then grouped into a Cluster. Also note that each of these entries has a ClientType which is 1 of ~6 strings such as 'Sales' or 'Utility'
Desire:
One variable for the Clusters, var mapClusters with the indecies as the ClientTypes. For example, mapClusters['Utility'] would return the one cluster, of ~6 in the array, which clusters the markers with ClientType=Utility.
I then want one more variable for the Markers, var mapMarkers. For example, mapMarkers['Sales'][3] would be the 4th marker in the Sales group. The order of objects in this 'sales' group does NOT matter.
Code:
var mapMarkers = [ ['Utility'], ['Court'], ['Sales'], ['Licensing'], ['Other'], ['Prospect'] ]; //2d array, ex: mapMarkers['Sales'][3]
var mapClusters = ; //1d array, ex: mapClusters['Utility']
....
( at the end of initMap() )
( for each entry in the GeoJson, generate var Marker for it and show on map. var clientType = the string value from the Geojson, such as 'Sales' )
mapMarkers[clientType].push(marker);
....
( after all markers have been generated, called for each Client Type )
mapClusters[clientType] = new MarkerCluster(...); //is null until first time this is called
Errors:
I am having trouble particularly with the "mapMarkers[clientType].push(marker)" and getting an error "Uncaught TypeError: Cannot read property 'push' of undefined". I also am not sure if mapClusters is being used the proper way either, but have not reached that part of the code at run-time to get any specific error.
Thanks for the help!
javascript arrays google-maps google-chrome
add a comment |
I'm working on a Google Maps Javascript API program and am having some trouble setting up arrays as I had intended.
Context:
When the map is initialized, a Geojson file is read and from its info a bunch of Markers (red pins) are created. Once created, these markers are then grouped into a Cluster. Also note that each of these entries has a ClientType which is 1 of ~6 strings such as 'Sales' or 'Utility'
Desire:
One variable for the Clusters, var mapClusters with the indecies as the ClientTypes. For example, mapClusters['Utility'] would return the one cluster, of ~6 in the array, which clusters the markers with ClientType=Utility.
I then want one more variable for the Markers, var mapMarkers. For example, mapMarkers['Sales'][3] would be the 4th marker in the Sales group. The order of objects in this 'sales' group does NOT matter.
Code:
var mapMarkers = [ ['Utility'], ['Court'], ['Sales'], ['Licensing'], ['Other'], ['Prospect'] ]; //2d array, ex: mapMarkers['Sales'][3]
var mapClusters = ; //1d array, ex: mapClusters['Utility']
....
( at the end of initMap() )
( for each entry in the GeoJson, generate var Marker for it and show on map. var clientType = the string value from the Geojson, such as 'Sales' )
mapMarkers[clientType].push(marker);
....
( after all markers have been generated, called for each Client Type )
mapClusters[clientType] = new MarkerCluster(...); //is null until first time this is called
Errors:
I am having trouble particularly with the "mapMarkers[clientType].push(marker)" and getting an error "Uncaught TypeError: Cannot read property 'push' of undefined". I also am not sure if mapClusters is being used the proper way either, but have not reached that part of the code at run-time to get any specific error.
Thanks for the help!
javascript arrays google-maps google-chrome
I think, your initialization ofmapMarkers
variable should be like this:var mapMarkers = {'Utility': , 'Court': , 'Sales': , 'Licensing': , 'Other': , 'Prospect' };
if you want to access it likemapMarkers['Sales'][3]
or usemapMarkers['Sales'].push(marker)
.
– Shidersz
Nov 21 '18 at 16:32
That did solve my issue, thanks! If you post as an answer I will mark it as the correct one ^^
– T Campbell
Nov 21 '18 at 16:54
I made an answer (with some explanation) as you order me.
– Shidersz
Nov 21 '18 at 17:37
add a comment |
I'm working on a Google Maps Javascript API program and am having some trouble setting up arrays as I had intended.
Context:
When the map is initialized, a Geojson file is read and from its info a bunch of Markers (red pins) are created. Once created, these markers are then grouped into a Cluster. Also note that each of these entries has a ClientType which is 1 of ~6 strings such as 'Sales' or 'Utility'
Desire:
One variable for the Clusters, var mapClusters with the indecies as the ClientTypes. For example, mapClusters['Utility'] would return the one cluster, of ~6 in the array, which clusters the markers with ClientType=Utility.
I then want one more variable for the Markers, var mapMarkers. For example, mapMarkers['Sales'][3] would be the 4th marker in the Sales group. The order of objects in this 'sales' group does NOT matter.
Code:
var mapMarkers = [ ['Utility'], ['Court'], ['Sales'], ['Licensing'], ['Other'], ['Prospect'] ]; //2d array, ex: mapMarkers['Sales'][3]
var mapClusters = ; //1d array, ex: mapClusters['Utility']
....
( at the end of initMap() )
( for each entry in the GeoJson, generate var Marker for it and show on map. var clientType = the string value from the Geojson, such as 'Sales' )
mapMarkers[clientType].push(marker);
....
( after all markers have been generated, called for each Client Type )
mapClusters[clientType] = new MarkerCluster(...); //is null until first time this is called
Errors:
I am having trouble particularly with the "mapMarkers[clientType].push(marker)" and getting an error "Uncaught TypeError: Cannot read property 'push' of undefined". I also am not sure if mapClusters is being used the proper way either, but have not reached that part of the code at run-time to get any specific error.
Thanks for the help!
javascript arrays google-maps google-chrome
I'm working on a Google Maps Javascript API program and am having some trouble setting up arrays as I had intended.
Context:
When the map is initialized, a Geojson file is read and from its info a bunch of Markers (red pins) are created. Once created, these markers are then grouped into a Cluster. Also note that each of these entries has a ClientType which is 1 of ~6 strings such as 'Sales' or 'Utility'
Desire:
One variable for the Clusters, var mapClusters with the indecies as the ClientTypes. For example, mapClusters['Utility'] would return the one cluster, of ~6 in the array, which clusters the markers with ClientType=Utility.
I then want one more variable for the Markers, var mapMarkers. For example, mapMarkers['Sales'][3] would be the 4th marker in the Sales group. The order of objects in this 'sales' group does NOT matter.
Code:
var mapMarkers = [ ['Utility'], ['Court'], ['Sales'], ['Licensing'], ['Other'], ['Prospect'] ]; //2d array, ex: mapMarkers['Sales'][3]
var mapClusters = ; //1d array, ex: mapClusters['Utility']
....
( at the end of initMap() )
( for each entry in the GeoJson, generate var Marker for it and show on map. var clientType = the string value from the Geojson, such as 'Sales' )
mapMarkers[clientType].push(marker);
....
( after all markers have been generated, called for each Client Type )
mapClusters[clientType] = new MarkerCluster(...); //is null until first time this is called
Errors:
I am having trouble particularly with the "mapMarkers[clientType].push(marker)" and getting an error "Uncaught TypeError: Cannot read property 'push' of undefined". I also am not sure if mapClusters is being used the proper way either, but have not reached that part of the code at run-time to get any specific error.
Thanks for the help!
javascript arrays google-maps google-chrome
javascript arrays google-maps google-chrome
asked Nov 21 '18 at 16:11
T CampbellT Campbell
42
42
I think, your initialization ofmapMarkers
variable should be like this:var mapMarkers = {'Utility': , 'Court': , 'Sales': , 'Licensing': , 'Other': , 'Prospect' };
if you want to access it likemapMarkers['Sales'][3]
or usemapMarkers['Sales'].push(marker)
.
– Shidersz
Nov 21 '18 at 16:32
That did solve my issue, thanks! If you post as an answer I will mark it as the correct one ^^
– T Campbell
Nov 21 '18 at 16:54
I made an answer (with some explanation) as you order me.
– Shidersz
Nov 21 '18 at 17:37
add a comment |
I think, your initialization ofmapMarkers
variable should be like this:var mapMarkers = {'Utility': , 'Court': , 'Sales': , 'Licensing': , 'Other': , 'Prospect' };
if you want to access it likemapMarkers['Sales'][3]
or usemapMarkers['Sales'].push(marker)
.
– Shidersz
Nov 21 '18 at 16:32
That did solve my issue, thanks! If you post as an answer I will mark it as the correct one ^^
– T Campbell
Nov 21 '18 at 16:54
I made an answer (with some explanation) as you order me.
– Shidersz
Nov 21 '18 at 17:37
I think, your initialization of
mapMarkers
variable should be like this: var mapMarkers = {'Utility': , 'Court': , 'Sales': , 'Licensing': , 'Other': , 'Prospect' };
if you want to access it like mapMarkers['Sales'][3]
or use mapMarkers['Sales'].push(marker)
.– Shidersz
Nov 21 '18 at 16:32
I think, your initialization of
mapMarkers
variable should be like this: var mapMarkers = {'Utility': , 'Court': , 'Sales': , 'Licensing': , 'Other': , 'Prospect' };
if you want to access it like mapMarkers['Sales'][3]
or use mapMarkers['Sales'].push(marker)
.– Shidersz
Nov 21 '18 at 16:32
That did solve my issue, thanks! If you post as an answer I will mark it as the correct one ^^
– T Campbell
Nov 21 '18 at 16:54
That did solve my issue, thanks! If you post as an answer I will mark it as the correct one ^^
– T Campbell
Nov 21 '18 at 16:54
I made an answer (with some explanation) as you order me.
– Shidersz
Nov 21 '18 at 17:37
I made an answer (with some explanation) as you order me.
– Shidersz
Nov 21 '18 at 17:37
add a comment |
1 Answer
1
active
oldest
votes
It seems you have a wrong initialization of the mapMarkers
variable for the purposes you expect. The way you initialize that variable is generating an array of arrays (each with length equal to 1), i.e, every array has one string inside. As you can check on next example, where I show how to manipulate that structure:
var mapMarkers = [ ['Utility'], ['Court'], ['Sales'], ['Licensing'], ['Other'], ['Prospect'] ];
// Display the structure format:
console.log(mapMarkers);
// Display first array inside.
console.log("First array of mapMarkers: ", mapMarkers[0]);
// Display the first element of the first array.
console.log("First element inside first array: ", mapMarkers[0][0]);
// Push new element on first array.
mapMarkers[0].push("Hello");
console.log(mapMarkers);
For your particular goal, it is better to use the next initialization, that represents an object with properties, where each property contains an empty array (at initialization):
var mapMarkers = {'Utility': , 'Court': , 'Sales': , 'Licensing': , 'Other': , 'Prospect': };
Using the previous initialization, you can manipulate the structure the way you expect, as you can check on the next example:
var mapMarkers = {"Utility": , "Court": , "Sales": , "Licensing": , "Other": , "Prospect": };
// Display the structure format:
console.log(mapMarkers);
// Display the array saved on the "Utility" property.
console.log("Utility array: ", mapMarkers["Utility"]);
// Push new elements on "Sales" array.
mapMarkers["Sales"].push("Sale1");
mapMarkers["Sales"].push("Sale2");
mapMarkers["Sales"].push("Sale3");
// Display the "Sales" array.
console.log("Sales Array: ", mapMarkers["Sales"]);
// Display second element of "Sales" array.
console.log("Second element of Sales array: ", mapMarkers["Sales"][1]);
// Display the structure after adding elements:
console.log(mapMarkers);
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416168%2fjavascript-1d-and-2d-arrays-with-string-indecies-and-push%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It seems you have a wrong initialization of the mapMarkers
variable for the purposes you expect. The way you initialize that variable is generating an array of arrays (each with length equal to 1), i.e, every array has one string inside. As you can check on next example, where I show how to manipulate that structure:
var mapMarkers = [ ['Utility'], ['Court'], ['Sales'], ['Licensing'], ['Other'], ['Prospect'] ];
// Display the structure format:
console.log(mapMarkers);
// Display first array inside.
console.log("First array of mapMarkers: ", mapMarkers[0]);
// Display the first element of the first array.
console.log("First element inside first array: ", mapMarkers[0][0]);
// Push new element on first array.
mapMarkers[0].push("Hello");
console.log(mapMarkers);
For your particular goal, it is better to use the next initialization, that represents an object with properties, where each property contains an empty array (at initialization):
var mapMarkers = {'Utility': , 'Court': , 'Sales': , 'Licensing': , 'Other': , 'Prospect': };
Using the previous initialization, you can manipulate the structure the way you expect, as you can check on the next example:
var mapMarkers = {"Utility": , "Court": , "Sales": , "Licensing": , "Other": , "Prospect": };
// Display the structure format:
console.log(mapMarkers);
// Display the array saved on the "Utility" property.
console.log("Utility array: ", mapMarkers["Utility"]);
// Push new elements on "Sales" array.
mapMarkers["Sales"].push("Sale1");
mapMarkers["Sales"].push("Sale2");
mapMarkers["Sales"].push("Sale3");
// Display the "Sales" array.
console.log("Sales Array: ", mapMarkers["Sales"]);
// Display second element of "Sales" array.
console.log("Second element of Sales array: ", mapMarkers["Sales"][1]);
// Display the structure after adding elements:
console.log(mapMarkers);
add a comment |
It seems you have a wrong initialization of the mapMarkers
variable for the purposes you expect. The way you initialize that variable is generating an array of arrays (each with length equal to 1), i.e, every array has one string inside. As you can check on next example, where I show how to manipulate that structure:
var mapMarkers = [ ['Utility'], ['Court'], ['Sales'], ['Licensing'], ['Other'], ['Prospect'] ];
// Display the structure format:
console.log(mapMarkers);
// Display first array inside.
console.log("First array of mapMarkers: ", mapMarkers[0]);
// Display the first element of the first array.
console.log("First element inside first array: ", mapMarkers[0][0]);
// Push new element on first array.
mapMarkers[0].push("Hello");
console.log(mapMarkers);
For your particular goal, it is better to use the next initialization, that represents an object with properties, where each property contains an empty array (at initialization):
var mapMarkers = {'Utility': , 'Court': , 'Sales': , 'Licensing': , 'Other': , 'Prospect': };
Using the previous initialization, you can manipulate the structure the way you expect, as you can check on the next example:
var mapMarkers = {"Utility": , "Court": , "Sales": , "Licensing": , "Other": , "Prospect": };
// Display the structure format:
console.log(mapMarkers);
// Display the array saved on the "Utility" property.
console.log("Utility array: ", mapMarkers["Utility"]);
// Push new elements on "Sales" array.
mapMarkers["Sales"].push("Sale1");
mapMarkers["Sales"].push("Sale2");
mapMarkers["Sales"].push("Sale3");
// Display the "Sales" array.
console.log("Sales Array: ", mapMarkers["Sales"]);
// Display second element of "Sales" array.
console.log("Second element of Sales array: ", mapMarkers["Sales"][1]);
// Display the structure after adding elements:
console.log(mapMarkers);
add a comment |
It seems you have a wrong initialization of the mapMarkers
variable for the purposes you expect. The way you initialize that variable is generating an array of arrays (each with length equal to 1), i.e, every array has one string inside. As you can check on next example, where I show how to manipulate that structure:
var mapMarkers = [ ['Utility'], ['Court'], ['Sales'], ['Licensing'], ['Other'], ['Prospect'] ];
// Display the structure format:
console.log(mapMarkers);
// Display first array inside.
console.log("First array of mapMarkers: ", mapMarkers[0]);
// Display the first element of the first array.
console.log("First element inside first array: ", mapMarkers[0][0]);
// Push new element on first array.
mapMarkers[0].push("Hello");
console.log(mapMarkers);
For your particular goal, it is better to use the next initialization, that represents an object with properties, where each property contains an empty array (at initialization):
var mapMarkers = {'Utility': , 'Court': , 'Sales': , 'Licensing': , 'Other': , 'Prospect': };
Using the previous initialization, you can manipulate the structure the way you expect, as you can check on the next example:
var mapMarkers = {"Utility": , "Court": , "Sales": , "Licensing": , "Other": , "Prospect": };
// Display the structure format:
console.log(mapMarkers);
// Display the array saved on the "Utility" property.
console.log("Utility array: ", mapMarkers["Utility"]);
// Push new elements on "Sales" array.
mapMarkers["Sales"].push("Sale1");
mapMarkers["Sales"].push("Sale2");
mapMarkers["Sales"].push("Sale3");
// Display the "Sales" array.
console.log("Sales Array: ", mapMarkers["Sales"]);
// Display second element of "Sales" array.
console.log("Second element of Sales array: ", mapMarkers["Sales"][1]);
// Display the structure after adding elements:
console.log(mapMarkers);
It seems you have a wrong initialization of the mapMarkers
variable for the purposes you expect. The way you initialize that variable is generating an array of arrays (each with length equal to 1), i.e, every array has one string inside. As you can check on next example, where I show how to manipulate that structure:
var mapMarkers = [ ['Utility'], ['Court'], ['Sales'], ['Licensing'], ['Other'], ['Prospect'] ];
// Display the structure format:
console.log(mapMarkers);
// Display first array inside.
console.log("First array of mapMarkers: ", mapMarkers[0]);
// Display the first element of the first array.
console.log("First element inside first array: ", mapMarkers[0][0]);
// Push new element on first array.
mapMarkers[0].push("Hello");
console.log(mapMarkers);
For your particular goal, it is better to use the next initialization, that represents an object with properties, where each property contains an empty array (at initialization):
var mapMarkers = {'Utility': , 'Court': , 'Sales': , 'Licensing': , 'Other': , 'Prospect': };
Using the previous initialization, you can manipulate the structure the way you expect, as you can check on the next example:
var mapMarkers = {"Utility": , "Court": , "Sales": , "Licensing": , "Other": , "Prospect": };
// Display the structure format:
console.log(mapMarkers);
// Display the array saved on the "Utility" property.
console.log("Utility array: ", mapMarkers["Utility"]);
// Push new elements on "Sales" array.
mapMarkers["Sales"].push("Sale1");
mapMarkers["Sales"].push("Sale2");
mapMarkers["Sales"].push("Sale3");
// Display the "Sales" array.
console.log("Sales Array: ", mapMarkers["Sales"]);
// Display second element of "Sales" array.
console.log("Second element of Sales array: ", mapMarkers["Sales"][1]);
// Display the structure after adding elements:
console.log(mapMarkers);
var mapMarkers = [ ['Utility'], ['Court'], ['Sales'], ['Licensing'], ['Other'], ['Prospect'] ];
// Display the structure format:
console.log(mapMarkers);
// Display first array inside.
console.log("First array of mapMarkers: ", mapMarkers[0]);
// Display the first element of the first array.
console.log("First element inside first array: ", mapMarkers[0][0]);
// Push new element on first array.
mapMarkers[0].push("Hello");
console.log(mapMarkers);
var mapMarkers = [ ['Utility'], ['Court'], ['Sales'], ['Licensing'], ['Other'], ['Prospect'] ];
// Display the structure format:
console.log(mapMarkers);
// Display first array inside.
console.log("First array of mapMarkers: ", mapMarkers[0]);
// Display the first element of the first array.
console.log("First element inside first array: ", mapMarkers[0][0]);
// Push new element on first array.
mapMarkers[0].push("Hello");
console.log(mapMarkers);
var mapMarkers = {"Utility": , "Court": , "Sales": , "Licensing": , "Other": , "Prospect": };
// Display the structure format:
console.log(mapMarkers);
// Display the array saved on the "Utility" property.
console.log("Utility array: ", mapMarkers["Utility"]);
// Push new elements on "Sales" array.
mapMarkers["Sales"].push("Sale1");
mapMarkers["Sales"].push("Sale2");
mapMarkers["Sales"].push("Sale3");
// Display the "Sales" array.
console.log("Sales Array: ", mapMarkers["Sales"]);
// Display second element of "Sales" array.
console.log("Second element of Sales array: ", mapMarkers["Sales"][1]);
// Display the structure after adding elements:
console.log(mapMarkers);
var mapMarkers = {"Utility": , "Court": , "Sales": , "Licensing": , "Other": , "Prospect": };
// Display the structure format:
console.log(mapMarkers);
// Display the array saved on the "Utility" property.
console.log("Utility array: ", mapMarkers["Utility"]);
// Push new elements on "Sales" array.
mapMarkers["Sales"].push("Sale1");
mapMarkers["Sales"].push("Sale2");
mapMarkers["Sales"].push("Sale3");
// Display the "Sales" array.
console.log("Sales Array: ", mapMarkers["Sales"]);
// Display second element of "Sales" array.
console.log("Second element of Sales array: ", mapMarkers["Sales"][1]);
// Display the structure after adding elements:
console.log(mapMarkers);
edited Nov 21 '18 at 17:41
answered Nov 21 '18 at 17:35
ShiderszShidersz
9,2962933
9,2962933
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416168%2fjavascript-1d-and-2d-arrays-with-string-indecies-and-push%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I think, your initialization of
mapMarkers
variable should be like this:var mapMarkers = {'Utility': , 'Court': , 'Sales': , 'Licensing': , 'Other': , 'Prospect' };
if you want to access it likemapMarkers['Sales'][3]
or usemapMarkers['Sales'].push(marker)
.– Shidersz
Nov 21 '18 at 16:32
That did solve my issue, thanks! If you post as an answer I will mark it as the correct one ^^
– T Campbell
Nov 21 '18 at 16:54
I made an answer (with some explanation) as you order me.
– Shidersz
Nov 21 '18 at 17:37