Decorators: Wrapping Class Members Playground

Mr. Jaya’s house gains a floor per decorator: Mrs. Yanti’s @log writes the guest book, Rizal’s @memo answers from his board, Dina’s @cek refuses a negative…

Why it matters

Decorators (a TC39 proposal that is not final, back at stage 2.7 since May 2026, yet already used by TypeScript 5 and many frameworks) attach behaviour to a method (logging, caching, validation, permissions) without mixing it into the core logic. Knowing the wrapping order means knowing why @memo over @log logs less than the other way round.

The key idea

A decorator replaces the method with a wrapper, bottom up

Common mistakes

Try it in this playground