Steven Noble Steven Noble - 5 days ago 6
Javascript Question

Is there a JavaScript (or jQuery) shortcut for "function(){return false;}"?

To prevent actions from happening, I frequently type

function(){return false;}


Is there a shortcut?

Answer

You could declare a named function like this:

function always_false() { return false; }

then use always_false() wherever you would have previously created the anonymous function.

Comments