I have an object
var foo = {
"prop1" : "value2",
"prop2" : "value3",
"prop3" : "value4"
};
and i'd love a way to have a function which would allow one to input multiple key and value pairs at once.
Right now I have this:
function propAndValAdder(){
for (var i = 0; i < arguments.length; i++) {
foo[arguments[i]] = [arguments[i + 1]];
}
}
Is this right?
Object.defineProperties()foo[arguments[i]] = [arguments[++i]];