So I have an object like this:
var obj = { foo: function() { ... }, bar: function() { ... }, baz: 10 };
I want to convert it to this using vanilla ECMAScript 3 Javascript:
[
{ name: "foo", value: function() { ... } },
{ name: "bar", value: function() { ... } },
{ name: "baz", value: 10 }
]
How can I do this?
Note: It has to work on IE8.
1with the first item as your whole starting object; i.e. if you triedarrayOfObjects[1]; // undefinedwhich is not desired behaviour