Skip to Content
JavaScript: Functional Programming for JavaScript Developers
book

JavaScript: Functional Programming for JavaScript Developers

by Ved Antani, Simon Timms, Dan Mantyla
August 2016
Intermediate to advanced
635 pages
14h 5m
English
Packt Publishing
Content preview from JavaScript: Functional Programming for JavaScript Developers

Prototype

The final creational pattern in this chapter is the Prototype pattern. Perhaps this name sounds familiar. It certainly should: it is the mechanism through which JavaScript inheritance is supported.

We looked at prototypes for inheritance but the applicability of prototypes need not be limited to inheritance. Copying existing objects can be a very useful pattern. There are numerous cases where being able to duplicate a constructed object is handy. For instance, maintaining a history of the state of an object is easily done by saving previous instances created by leveraging some sort of cloning.

Implementation

In Westeros, we find that members of a family are frequently very similar; as the adage goes: "like father, like son". As each generation ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering JavaScript Functional Programming

Mastering JavaScript Functional Programming

Federico Kereki

Publisher Resources

ISBN: 9781787124660