I have an array with keys and values which elements i want to push into 2 different arrays (key into one and value into another)
here is the code i have used:
// the array i want to split
var defaultc = {
'a':'r019',
'b':'r027',
'c':'r027',
'd':'r027',
'e':'r047'
};
// the array i want to add to
var step_layer = []; // keys to this
var step_colour = {}; // values to this
$('#reset').click(function() {
$.each(defaultc, function(layer, colour) {
// both these functions are working properly
apply_changes(layer, colour);
sumary(layer, colour);
});
// this part is not
for (var layer in defaultc) {
if (!defaultc.hasOwnProperty(layer)) {
step_layer.push(layer);
step_colour[layer].push(colour);
}}
return false;
});