From the course: JavaScript: Patterns
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Module pattern - JavaScript Tutorial
From the course: JavaScript: Patterns
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
What are structural patterns?55s
-
(Locked)
Module pattern5m 54s
-
(Locked)
Mixins pattern4m 32s
-
(Locked)
Facade pattern1m 43s
-
(Locked)
Flyweight pattern1m 18s
-
(Locked)
Decorator pattern2m 16s
-
Model-View-Controller (MVC) pattern1m 21s
-
Model-View-Presenter (MVP) pattern1m 17s
-
(Locked)
Model-View-ViewModel (MVVM) pattern1m 25s
-
(Locked)
-
-