Can someone explain this term for me and describe a typical programming situation where first-class functions are used? Thanks
Explain the term 'First-class functions' in relation to Javascript
473 views Asked by hiimmrwood At
1
Can someone explain this term for me and describe a typical programming situation where first-class functions are used? Thanks
We often hear that JavaScript functions are first-class functions, meaning both functions and objects are treated by the language as the same thing. In practical terms, a function can be stored as a variable, inside an array or an object, as well as it can be passed as an argument or be returned by another function. That makes functions “first-class citizens” in JavaScript.
These are the examples:
Refer the following links
http://odiseo.net/javascript/first-class-functions-in-javascript-how-comes-functions-are-treated-as-objects-in-js
http://www.developerfusion.com/article/84433/first-class-functions/