i'm working on a project in which i need to shuffle an object array on DOM ready while also preserving keys.
Example:
var o = [
{"key_1": {
"bruce wayne": "batman"
}},
{"key_2": {
"peter parker": "spiderman"
}},
{"key_3": {
"bruce banner": "hulk"
}}
];
After:
var o = [
{"key_3": {
"bruce banner": "hulk"
}},
{"key_1": {
"bruce wayne": "batman"
}},
{"key_2": {
"peter parker": "spiderman"
}}
];
i've tried doing this a few different ways but haven't been successful. at this point i'm also not sure if this is the best approach for this.
Additional Info: the application has to iterate through the array, showing one key set at a time.
-appreciate any direction,