var foo = function(a, b, c) {
console.log(a);
console.log(b);
console.log(c.id);
};
//this works obviously
foo("a man", "b man", {id: "c.id man"});
var par = {
a: "a val",
b: "b cal",
c: {
id: "c.id val"
}
};
//can I make this work automatically?
foo(par);
Question is in code sample.
Can I automatically "unwrap" the par object to use the properties to fill in the function parameters?
Is there some kind of foo(par.unwrap())
in javascript?