Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript Quickstart!
You have completed JavaScript Quickstart!
Preview
Most of the time, you'll see the function passed to forEach
(callback function) written as an arrow function, using the new arrow syntax (=>
). This is a new, shorter syntax for writing functions in JavaScript.
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
Most of the time you'll see the call
back function, or the function being
0:00
passed to for each, written as an arrow
function, using the new fat arrow syntax.
0:04
This is a new, shorter syntax for
writing functions in JavaScript.
0:09
For example,
I can shorten the function inside for
0:12
each by replacing the function
keyword in parentheses.
0:16
With movie and a fat arrow which
is just an equal sign immediately
0:20
followed by right angle bracket.
0:25
Better yet,
arrow functions with one statement,
0:27
like this one,
can be condensed to one line so
0:32
I can place everything on one line,
like so.
0:36
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