While I have many years experience programming (in numerous languages), my background is not Javascript. Added to that is the fact that the Javascript of today is not the Javascript I first played with many years ago. It's much more sophisticated and powerful. That said, I'm struggling to understand some function payload dynamics.

Function calls where the function actually returns something are intuitive, but Javascript seems to do something with functions that I can't get my head around. I could just copy/paste code, or I could try to work out how to reuse this pattern in my own code.

For example, the following Mongoose call does a find of all records in the User model, and somehow the result of the call ends up in the second argument of the passed function (by reference?).

```
User.find({}, function(err, users) {  // Get all the users
  if (err) throw err;

  console.log(users); // Show the JSON Object    
});

```

Here's another example using a simple forEach on an array. Somehow, the forEach populates the 'user' argument. 

```
users.forEach(function(user) {
        console.log(user.username, ': Admin = ', (user.admin ? 'Yes' : 'No'));
});

```

Can anyone explain this, and/or point me to a good guide on how/why this works?

I've seen the same pattern across Node.js and it's a bit of a stumbling block.

Have I missed something obvious or is this simply a peculiarity around functional programming?

Jon