Empty functions in Javascript

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.

Leave a Comment