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 trialHernan Diaz
7,197 PointsSyncronous or asyncronous
when does some file is executed asyncronously?
I can't yet understand when a file is going to follow the sequence or when it won't
thanks
2 Answers
Steven Parker
231,271 PointsCode execution is synchronous unless it is triggered by some event. Functions that perform asynchronously will nearly always take a callback argument that will be executed at some future time. Callbacks can usually be identified because they are referenced but not invoked. For example:
sample = myfunc(otherfunc(), 1200); // synchornous, "otherfunc" will be called now
timeid = setTimeout(otherfunc, 1000); // asynchronous, "otherfunc" will be called later
The asynchronous mechanisms should be clearly pointed out when they are introduced in the courses.
Hernan Diaz
7,197 PointsThank You