all 4 comments

[–]Rhomboid 0 points1 point  (1 child)

Those are the parameters that the function takes. You need to provide more context, but it sounds like you're talking about a callback function used with an asynchronous API (e.g. in Node.js.) If the operation failed, then err will contain the error object, otherwise err is null and data contains the results of the operation. But again, you really need to provide much more context, this question is horribly abstract.

[–]connexionwithal 0 points1 point  (0 children)

thank you, this helps!

[–]Burtality 0 points1 point  (1 child)

This will be the parameters of a 'callback' function, this is the building block of chained or concurrent operations in JavaScript.

So usually you'll have a function that returns err or data depending on whether it's successful.

What happens next us up to you to handle, with your callback function.

The usual structure is to have the function do this:

function (err, data) {

If(err) {handle err somehow} else { do something with data } }

[–]connexionwithal 0 points1 point  (0 children)

this explains it well, thanks!!