// Using the require keyword lets us access all of the exports
// in our ess.js file
var stuffINeed = require("./ess.js");
// This will print everything in exports.
console.log("--------------------------");
console.log("ALL THE STUFF I NEED");
console.log(stuffINeed);
console.log("--------------------------");
// These will print correctly because we imported them
console.log("Essentials");
console.log(stuffINeed.essentials);
console.log("--------------------------");
console.log("Nice to Haves");
console.log(stuffINeed.niceToHaves);
// This won't print anything because it wasn't exported in ess.js
console.log("--------------------------");
console.log("Nonessentials");
console.log(stuffINeed.nonessentials);
var essentials = {
drink: "water",
eat: "snickers",
fun: "phone",
friend: "facebook"
};
var niceToHaves = {
tools: ["can opener", "flashlight", "matches"],
safety: ["first aid kit", "gloves"]
};
var nonessentials = {
cookware: "waffleMaker"
};
// module.exports is essentially an object that we can add data or variables to
// We can access them from other files using the 'require' keyword.
module.exports = {
essentials: essentials,
niceToHaves: niceToHaves
};