Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
In this video, we'll recap what you've learned with callbacks.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
Well done.
0:04
Callbacks can be challenging but
they're a powerful tool in asynchronous,
0:05
event based programming.
0:09
They're everywhere in JavaScript.
0:11
I encourage you to take the course
again if you're still having problems
0:13
surrounding callbacks.
0:17
The second time through,
there may be some more a ha moments.
0:18
Let's recap on some of
the things that you've learned.
0:22
Functions are often referred to as
first class objects in JavaScript.
0:25
All this means is that a reference
to the function can be passed around
0:29
just like any other variable.
0:33
Remember, a callback
function is like any other.
0:35
Instead of call by you in the code it's
being triggered by a system event.
0:39
In the case of setTimeout,
0:44
the callback is invoked after a delay
which is supplied as a second argument.
0:46
Remember, you don't include parenthesis
when you pass in the name of
0:51
the function since that would
invoke the function immediately.
0:55
Callbacks can be expressed as an anonymous
function too or an arrow function.
1:00
Some callbacks can have
arguments passed in.
1:06
In the case of the addEventListener,
1:09
the callback can have a single
argument passed in, the event object.
1:12
Callbacks are everywhere in JavaScript,
whether you stay in the front-end, or
1:17
move over to the back-end with Node.js.
1:21
You'll encounter them in all of
your JavaScript developer life.
1:23
I hope you enjoyed this course, and
until next time, keep on coding.
1:27
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up