Skip to content

Instantly share code, notes, and snippets.

@SteveOscar
Created April 3, 2016 22:02
Show Gist options
  • Save SteveOscar/8956d7404ab5227f5ec4a5682350dc85 to your computer and use it in GitHub Desktop.
Save SteveOscar/8956d7404ab5227f5ec4a5682350dc85 to your computer and use it in GitHub Desktop.
The Concept of Require

#####In the context of Node, what is a module?

  • Modules are groupings of code that serve similar purposes.
  • They are more or less the JS version of a Ruby class, a way to break up and group up sections of code.

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

  • While the first blog post described how to use module.exports, which is the technique we've already been exposed to, the second article was talking about using RequireJS, a JavaScript file and module loader. RequireJS can be used to create modular chunks of code using a define function. Mutliple dependencies can be declared in another file through a define call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment