Skip to content

Instantly share code, notes, and snippets.

@acareaga
Forked from rrgayhart/require.markdown
Last active February 9, 2016 20:37
Show Gist options
  • Save acareaga/1ed7304abf4180512300 to your computer and use it in GitHub Desktop.
Save acareaga/1ed7304abf4180512300 to your computer and use it in GitHub Desktop.
The Concept of Require

Read Node.js, Require and Exports and Organize Your Code with RequireJS

Fork this gist and answer the following questions:

In the context of Node, what is a module?

A way to contain variables/functions/classes and expose them using a module.exports syntax to export everything you specify.

The code examples from the second blog post look very different from the first. Why?

With Require.js, the code is written in self contained modules using define(). This allows you to require() the modules in a main.js file, and require only the main JS file in the HTML script tag.

@rrgayhart
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment