How can I use a dictionary of text names and values to set properties on an object? For example...
I need to populate this object:
item = {}; Using this collection of values (note everything is a string):
values = [ { id: 1, name: "a", value: "true" }, { id: 2, name: "b", value: "false" }, { id: 3, name: "c", value: "100" }, { id: 4, name: "d", value: "[email protected]" } ]; So that the original object looks like this:
item = { a: true, b: false, c: 100, d: '[email protected]' } Sorry for being so vague, but I'm not sure where to even start.