Book Image

Lo-Dash Essentials

By : Adam Boduch
Book Image

Lo-Dash Essentials

By: Adam Boduch

Overview of this book

Table of Contents (15 chapters)
Lo-Dash Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 3. Working with Functions

You'll find functions everywhere within a sufficiently large piece of JavaScript code. That's because they're treated in the same way as any other primitive type. Everything is an object in JavaScript, including functions. Functions have a context and a prototype, and they can be assigned to a new context and to variables.

Lo-Dash helps to best utilize functions. Where there are missing pieces, the utilities that Lo-Dash provides let us write some truly elegant, functional code. This chapter dives into these utilities. Whether we're changing the meaning of this or decorating an existing function, we'll walk through examples that illustrate how to get started.

In this chapter, we will cover the following topics:

  • Binding function contexts

  • Decorating functions

  • Function constraints

  • Timed execution

  • Composing and currying functions