Javascript - Trouble using for…in to iterate through an object
I have a dynamically-generated object that looks like this: colorArray = { AR: "#8BBDE1", AU: "#135D9E", AT: "#8BBDE1", ... } I'm trying to use it to color a map by using this plugin and the 'colors' attribute during the call to the plugin. Like this: $('#iniDensityMap').vectorMap({ backgroundColor: '#c2e2f2', colors: colorArray, ... (some other params) }); But it doesn't color in the countries. When I hard code this in, it works fine - but it must be dynamically generated for this project, so something like this won't work for me (although it does in fact color the map): $('#iniDensityMap')