Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Brian Patterson19,588 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 Teacher
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!