From the course: JavaScript: Patterns

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Module pattern

Module pattern

The module pattern is probably the one pattern where if you are not aware you are using it; You'll be like, oh yes I know this one. The module pattern is used everywhere in our code. Especially if you use any frameworks. Whenever you're encapsulating a block of code into a singular function or a pure function, as it is sometimes referred to, you're creating a module. The idea behind using modules is to organize your code in pure functions. So if you have your code to debug, it is much easier to find where the error is. We often use modules too, with the key word import or export. So when we compile our code, we only use the code we need. In the exercise files there is a folder called node. So if you look into the exercise files, you'll find in the resources, this folder here. So copy the content of that folder into a new folder; or simply use it. So I'm going to create a brand new folder on my desktop. And I'm…

Contents