I have a function like this :
module.exports.download = function (cb) {
// Some Code
cb();
}
Is it the same to do this :
module.exports.copyimagefromalbumnext = function (callback) {
module.exports.download(callback);
}
or
module.exports.copyimagefromalbumnext = function (callback) {
module.exports.download( function () { callback(); } );
}
In advance thanks.
Is
callback
the same asfunction () { callback(); }
No. The second function neither cares about this
context, passed arguments, nor the return value of an invocation. You could do
function() { return callback.apply(this, arguments); }
but that's just superfluous. Use the first approach and pass callback
itself.