


Here we assigned the anonyms function to the variable.Īnd calls the function with that variable. Functions returns from another Function Function saved to variables/constants/objects/arrays.Functions can be passed as a parameter to a function.Functions can be assigned to variables/constants/objects/arrays.We will see detailed tutorials using functions as equal to using a variable with examples below. It is also called First class citizens or First class objects of Javascript

That means functions are saved to variables, passed as a parameter to function, and returned from the function. whatever you do with variables, you can do everything with javascript functions also. First Class Functionsįirst-class functions in any programming are called for functions if Functions can be treated the same as variables. Testmethod.name prints the function name. Console.log(testmethod) // returns function codeĬonsole.log(testmethod.name) // returns testmethodĪfter running the above code, It just returns a function.įunctions also have properties, one of the properties is the name.
