Brian Patterson19,584 Points
node not responding.
Me again. Sorry being really thick here. Or is Andrew explaining this really badly? I am trying have tried to separate the code into two files. Here is my season.js code.
And here is my seasonF1.js file.
const season = require('./season.js'); const seasons = process.argv.slice(2); seasons.forEach(season.get);
When I run node season.js it returns nothing.
Also, I don't understand about the module.exports.get = get; He does a great job of explaining this badly.
Jennifer NordellTreehouse Moderator
Hi there, Brian! I'm glad you got it partially worked out. As for the
module.exports.get = get part. I can try and explain it briefly. You have a function in the first file named
get. And we want our other file to be able to use that function. So we export it in a module. That and we export it as the same name ...
get. And there's a reason we do this: to avoid collisions. Imagine for a moment potentially how many frameworks out there have a
get function. Probably hundreds or more.
There is a workshop on this very thing at Treehouse. It's about 16 minutes long and will likely clear this up for you entirely. I recommend you take a look at this workshop
Hope this helps!