In JS, there is shorthand for an empty object which is {}
. Is there shorthand for an empty function
in JS?
The reason being, as functions are first-class objects, we use them as arguments more often, but passing in an empty function is at best ugly.
var foo = baz(function(){});
In order to declare a function, at somepoint we have to declare function(){}
.
I would like more Node.js APIs to require a (callback) function to be passed, so the API doesn't deceivingly look synchronous. Perhaps one step in that direction would be to create shorthand for empty placeholder functions.