About Me

Self-motivated professional specialising in crafting isomorphic front-end applications with responsive and elegant user experiences.
I believe in thinking as the end-user and building something that everyone would love to use.More about me.

JavaScript and “First-class functions”.

JavaScript is one of the languages which claim to feature “First Class Functions”. So, what does it mean to be first class function? Let’s explore.

I like to compare it to being a first class citizen. Basically the right to freely move across boundaries in the country without being questioned of your purpose.

In the programming context, being first-class, gives JavaScript functions the ability to be saved in variables, passed around as arguments or even returned from other functions. Taking this a step further, functions can reside inside objects as one of the properties.

Note that in languages which support first-class functions, the name of the function does not play a big role. The name is just a variable pointing to the location of the function definition.

This might sound trivial to existing JS developers, but it is actually a boon. First-class functions are a necessity for “Functional Programming” paradigm.

Other languages which support them include PHP, Lua, Perl, Python, and Io.