How to create a javascript function that will receive a JSON-like object as parameter, like this:
function foo() {
//handle args somehow
}
And then be able to call it like this:
var someObj = {
arg1: "some",
arg2: "thing",
options: {
opt1: "asd",
opt2: false
}
}
foo(someObj);
Also, how to treat parameters that are not sent to the function (opt2 is omitted in this case):
var someObj = {
arg1: "some",
arg2: "thing",
options: {
opt1: "asd",
//opt2: false
}
}
foo(someObj);
Thanks.