Check out a free preview of the full The Hard Parts of Functional JavaScript course:
The "Function Decoration Review" Lesson is part of the full, The Hard Parts of Functional JavaScript course featured in this preview video. Here's what you'd learn in this lesson:

Will summarizes the example of function decoration he went through in the previous section.

Get Unlimited Access Now

Transcript from the "Function Decoration Review" Lesson

>> Will Sentance: Function decoration, easier to add features, we can pseudo, I mean that could appear to edit our existing functions. In our functional programming world, we wanna save every single little bit of code as a function to be able to use again and again. I wanna be able to reuse them as much as possible.

[00:00:19] Sometimes that would mean writing a brand new function, or decorating, and therefore, appearing to edit our functions in order we can use them in different situations. We were able to edit our multiply by two function to create one that behaved like multiple by two, but had a bonus feature.

[00:00:39] That it was only allowed to be run once, and when it's run again, was limited to saying sorry. That is [SOUND] for the first time ever our functions got memories. Meaning we can convert existing functions or at least appear to by creating a brand new function inside of it, storing it in its backpack the function we wanna have trigger to run.

>> Will Sentance: [SOUND] Easier to debug [SOUND] definitely need to know how this works under the hood.