NodeJS patterns — The decorator pattern

  • name is the name of the instance
  • account is the amount of money owed by the instance
  • items is an array with objects bought by the instance

Now is the interesting part.





Full Stack Web Developer |

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

A Quick Example of Genetic Evolution in JavaScript: Let’s Make a Baby.

WSO2 API Manager new look!

Next.js vs React

Building RESTful APIs With NestJS: Getting Started

Wallpaper Aesthetic Kotak Kotak

Encapsulated CSS: The Key to Composable Layouts

Vulcan.js 1.14: Filtering + New APIs

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Zaharia Anton

Zaharia Anton

Full Stack Web Developer |

More from Medium

How to use fetch in NodeJS

Image saying { FETCH API }

Topics: Mongodb overview, mongoose, mongodb queries

Get Started with MongoDB Atlas — MongoDB

Getting Started with Node.js