+ 3

What means first class functions?

Can someone explain what means first class functions in javascript?Thank you.

22nd Feb 2017, 7:50 PM
Mariamita
Mariamita - avatar
2 Answers
+ 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.
22nd Feb 2017, 8:33 PM
1of3
1of3 - avatar
+ 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/
22nd Feb 2017, 8:22 PM
Yurii Zadorozhnyi
Yurii Zadorozhnyi - avatar