I have coded a function, that has 3 arguments, one of them is a callback function.
How do I make the callback an optional argument without having to code another function without the callback argument?
function myFunction(arg1, arg2, callback){
// do something
// callback() if it has been passed
}
Simple, just check if callback is defined before you call it.