Following the pattern recommended in this question, where we have something akin to:
function foo(a, b, opts) {
}
foo(1, 2, {"method":"add"});
foo(3, 4, {"test":"equals", "bar":"tree"});
How would one then include a callback as the final parameter? I have function foo()
that should be able to handle both of:
foo(x, y, function() {
// do stuff
});
And
foo(x, y, z, function() {
// do stuff
});
Any suggestions?