How to log arguments from within a higher order function in JavaScript?

I have the following example functions:

example((a, b, c, d) => {
c(a);
d(b);
});

example((a, b, c, d, e, f, g) => {
ex({ a, b, c, d, e, f, g });
});

function ex({ b, d, e, f, g, a, c }) {
b(a)(c)(d)(e);
b(f)(g);
}

How do I modify the function:

function example(fn) {}

So that the following output is logged:

c a
d b
b a c d e
b f g