Solution: Leveraging module caching


show more Solution: Leveraging module caching provides you with in-depth training on Developer. Taught by Joseph LeBlanc as part of the Node.js Essential Training (2013) show less
please wait ...

Solution: Leveraging module caching

Here's my solution to the challenge. I'm already in terminal, and I'm going to change directory to the solution folder that I already have on the desktop. I'm going to drag this folder in, so that I get the path. Now, I'm going to run my code. I'm going to type node space app.js. On the second to last line it shows how many flights were created. And then on the final line it shows all the destinations served. So let's take a look at how this was done. First, let's take a look at index dot js in Flight.

On lines one and two I'm defining two variables that are local to this module. The first one is count. I'm initially setting this to zero and it's going to keep track of how many flight objects get created out of this module. The second one is destinations. I'm setting this to an empty array and we're going to keep track of each destination as it gets added through this module. Now I'm going to skip over the entire flight function and go down to the...

Solution: Leveraging module caching
Video duration: 2m 13s 3h 17m Intermediate

Viewers:

Solution: Leveraging module caching provides you with in-depth training on Developer. Taught by Joseph LeBlanc as part of the Node.js Essential Training (2013)

Subject:
Developer
Software:
JavaScript Node.js
Author:
please wait ...