+ 3
What means first class functions?
Can someone explain what means first class functions in javascript?Thank you.
2 odpowiedzi
+ 3
You might think of functions as manipulations of thing. But functions are also things and can therefore be manipulated. Think of the derivative in math. It's a function that turns functions into other functions.
When a programming language allows that, we say that the functions are first class citizens in that language.
+ 2
In JavaScript functions are first-class. This mean that with functions you can do everything you can do with other types such as assigning them to variables.
Wikipeida on first-class functions:
In computer science, a programming language is said to support first-class functions (or function literal) if it treats functions as first-class objects. Specifically, this means that the language supports constructing new functions during the execution of a program, storing them in data structures, passing them as arguments to other functions, and returning them as the values of other functions.
Resourse and more information:
http://timmknight.github.io/2015/first-class-functions-javascript/