No, there is not. With ES6, you might be able to use an arrow function: ()=>{} which is a bit shorter.
If you really need this very often (you shouldn't?!), you can declare one yourself:
function noop(){}
and then refer to that repeatedly. If you don't want to clutter your scope, you can also use the Function.prototype function (sic!) which does nothing but constantly return undefined - yet that's actually longer than your function expression.
No, there is not. With ES6, you might be able to use an arrow function: ()=>{} which is a bit shorter.
If you really need this very often (you shouldn't?!), you can declare one yourself:
function noop(){}
and then refer to that repeatedly. If you don't want to clutter your scope, you can also use the Function.prototype function (sic!) which does nothing but constantly return undefined - yet that's actually longer than your function expression.
ES6 one could be:
const noop = () => {};
Be careful if using Babel as it compiles differently - instead you can explicitly return something:
const noop = () => ({});
See this tweet as to why the curly braces are important: https://twitter.com/_ericelliott/status/601420050327711744?lang=en
Videos
I don't know what jsLint thinks but if this is a problem and you need a solution then you can do something like the following:
var blah = function() { return undefined; }; // or just return;
Update : I think, Bergi's guess is right because, on the jslint site in the Required Blocks section :
JSLint expects that if, while, do and for statements will be made with blocks {that is, with statements enclosed in braces}.JavaScript allows an if to be written like this:if (condition) statement;That form is known to contribute to mistakes in projects where many programmers are working on the same code. That is why JSLint expects the use of a block:
if (condition) { statements; }
Experience shows that this form is more resilient.
So, It probably just checks for empty blocks { } and invalidate the blank function.
Use the lambda expression:
const blah = () => void 0;
This will make it clear that blah is an empty function that returns undefined.