Harnessing the power of the Function Object
Added 4 Mar 2009
The JavaScript language can operate equally well within many of the
major programming paradigms. The first programming model most students
learn is Procedural Programming; so called because procedures
(functions) are used to group similar functionality. JavaScript also
supports most of the features of the Object-Oriented (OO) model, such
as encapsulation, modularity, polymorphism and inheritance. Perhaps not
a pure OO language like Java, the proliferation of JavaScript
Frameworks in recent years, as well as the inclusion of new
functionality in later versions of JavaScript, have brought the
language closer to true OO style. In this article, we explore the
Function object and learn about its role in a lesser known style of
coding called Functional Programming. Our specific area of focus is the
Functional Programming concept of using Higher Order functions to
improve code modularity. Ironically, JavaScript might be the most
widely deployed Functional Programming language in use today, but most
people are unaware of this fact. That's a shame, because the Functional
Programming style is one of our best allies in writing well-structured
and modularized code.