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! While you're at it, check out some resources Treehouse students have shared here.

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

JavaScript

Just curious about the results of the command line.

Video: https://teamtreehouse.com/library/organizing-your-code-with-require Minute 2:50
CLI : node app.js chalkers davemcfarland Dave's results printed to the screen first and Chalkers results second. In a different video, Chalkers ran the same command, only this time with Alena Holligan's profile and her results came up first. Since Node is non-conflicting and Alena's profile is smaller than Chalkers, then node printed her results to the console first. However, in the current video mentioned above, I see Dave's profile is larger than Chalkers and yet, Dave's results printed first and Chalkers second. Shouldn't be the other way around? Perhaps, a smaller profile doesn't necessarily finish running before a larger profile? I'd also like to know if node gets exhausted to run if a profile is too big and a message like 'Server Timeout' is displayed. I apologize if this question isn't clear.

1 Answer

Patrik Horvรกth
Patrik Horvรกth
11,110 Points

Hi, christian gamboa

it doesnt metter if it has more data or not sometimes you get larger first and sometimes not you can test it :), but you can do for example

function1();
setTimeout(function2, 3000);  // this run after 3 secs after code execute ( not after func 1 ) 

also you can set if you want it Async or Sync - Sync is by default :)