O'Reilly logo

JavaScript: Functional Programming for JavaScript Developers by Dan Mantyla, Simon Timms, Ved Antani

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Function passing

In functional programming languages, functions are first class citizens. Functions can be assigned to variables and passed around just like you would with any other variable. This is not entirely a foreign concept. Even languages such as C had function pointers that could be treated just like other variables. C# has delegates and, in more recent versions, lambdas. The latest release of Java has also added support for lambdas as they have proven to be so useful.

JavaScript allows for functions to be treated as variables and even as objects and strings. In this way JavaScript is functional in nature.

Because of JavaScript's single threaded nature, callbacks are a common convention and you can find them pretty much everywhere. Consider ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required