Javascript: Generating object keys inside a loop and pushing an array of objects into each?

You can't use push on an Object, only on array. I think this is what you want to do.

You can't use push on an Object, only on array. I think this is what you want to do: function buildPoints() { var marker_container = new Object(); for ( I = 0; I Length; h++) { var marker = new google.maps. Marker({ position: new google.maps.

LatLng(waypoint_datanightsih0, waypoint_datanightsih1), icon: waypoint_datanightsih2, shape: pointshape, map: map }); //Push waypoints into date-specific object key marker_containernightsi. Push(marker); } } } simple proof of concept jsfiddle.

Marker_container shouldn't be an array since he's using strings as keys (nightsi) – dtanders Sep 15 '11 at 16:39 @dtanders good point, I changed it to an object. – Brian Glaz Sep 15 '11 at 16:47 Ah yes, this is exactly what I was trying to achieve! Thank you.

– petroica Sep 15 '11 at 17:00 You're welcome =) – Brian Glaz Sep 15 '11 at 17:03.

If you know how many markers you'll have (let's say 10), set-up the marker container, making each element of the object an object itself, of length 2: marker_container= new Object(10); for (i=0; iSetMap(null).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions