but are then() and body() functions?
then and body are parameters. Their values depend on the values that are passed to unless and repeat. So in order to determine what the values are (i.e. whether they are functions or not) you need to look at where unless and repeat are called and which values are passed to them.
Keep in mind that, in general, repeat and unless can be called multiple times. The values of then and body can be different for every function call, but they will have to be of the type (number, string, function, ...) the function expects, otherwise it won't work correctly.
Where are they defined?
In your example, repeat and unless are called here:
repeat(3, function (n) {
unless(n % 2, function () {
document.write(n + " is even<br>");
});
});
You can see that the second arguments passed to repeat and unless are indeed functions.
What's the value of n?
Lets have a look where the function is called. The function is passed as second argument to repeat. repeat uses body to refer to the second argument and it laters calls it as body(i) in a loop. i will have the values 0 to times - 1. times is the first argument passed to repeat which in your example is 3. So the function will be called multiple (three) times, receiving the values 0, 1 and 2.
thenandbodyare just the names given to the arguments. The code assumes they are functions (and will fail nastily if you pass them something else) and calls them. In this case, since they are functions, it works just fine. They are defined in the argument list of the call itself.n?" Whatever is passed to the function. Look at where the function is called. "isn't the function supposed to have a name" No, functions don't have to have a name. How parameters work doesn't suddenly change when you pass a function. Simplest example:function foo(n) { console.log(n); }; foo(5); foo(function() {});. In the first call,nwill have the value5, in the second callnwill refer to a function.