Prototype This page is part of the Prototype JavaScript framework documentation.
Overview | (...)

Prototype.emptyFunction provides a reference to a anonymous Java Script function that does nothing.

Syntax

Prototype.emptyFunction is useful where you maybe get a callback parameter in the form of a function, and want to have cleaner code:


function example() {
  var callback = arguments[1] || Prototype.emptyFunction;
  callback();
}

In the example, the example function has an optional parameter which will be assigned to the callback variable. If the optional parameter is not given, it uses Prototype.emptyFunction instead.