Hints and tips

Here are a couple of brief tips to keep in mind about some of the patterns we've seen in this chapter:

  • When implementing the interpreter pattern you may be tempted to use JavaScript proper as your DSL and then use the eval function to execute the code. This is actually a very dangerous idea as eval opens up an entire world of security issues. It is generally considered to be very bad form to use eval in JavaScript.
  • If you find yourself in the position to audit the changes to data in your project, then the memento pattern can easily be modified to suit. Instead of keeping track of just the state changes, you can also track when the change was made and who changed it. Saving these mementos to disk somewhere allows you to go back and ...

Get JavaScript: Functional Programming for JavaScript Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.