A function that does nothing, takes no arguments and returns nothing is traditionally called a noop
, or no-op. An example of a noop is below:
function noop(){}
http://en.wikipedia.org/wiki/NOP
So is there a name for a function which is meant only to return its arguments, and not do anything else? An example of this kind of function:
function(a){return a}
6
It’s called the identity function and is sometimes abbreviated as id
in category theory and functional programming languages.
5