I possess an object
var bar = {
"propA" : "valueX",
"propB" : "valueY",
"propC" : "valueZ"
};
and I am looking for a method to create a function that can receive multiple key and value pairs all at once.
My current approach is as follows:
function addPropAndVal(){
for (var j = 0; j < arguments.length; j++) {
bar[arguments[j]] = [arguments[j + 1]];
}
}
Does this seem correct?