Book Image

Learning Underscore.js

By : Alexandru Vasile Pop
Book Image

Learning Underscore.js

By: Alexandru Vasile Pop

Overview of this book

Table of Contents (14 chapters)
Learning Underscore.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The functional programming paradigm


In the first chapter, we described a couple of the principles behind the functional programming paradigm. Underscore in itself is a great example of applying functional programming in JavaScript while the jQuery library also observes functional programming principles.

Up until the current chapter, all the examples tried to remain close to functional programming principles and you already saw some of these principles in action:

  • Using functions as first-class citizens in most of the examples

  • Using objects as data structures while relying on standalone functions (as opposed to object methods) for implementing functionality in most of the examples

  • Using higher-order functions and immutability in the collections and arrays examples

  • Functional composition in the functions examples

Alongside immutability an important concept in functional programming is using functions that don't have side effects. These are functions that do not modify the global state or outside...