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 Functions!
You have completed JavaScript Functions!
Preview
Learn how arrow functions provide a special, more concise syntax for creating functions. Arrow functions are similar to function expressions; they're appropriately called "arrow function expressions."
Resources
Rewrite the getArea function declaration as an arrow function:
const getArea = (width, length, unit) => {
const area = width * length;
return `${area} ${unit}`;
};
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
that it provides different and perhaps
more efficient ways to do similar things.
0:00
Working with functions
is one of those things.
0:03
So far you've learned how to write
a function as a declaration and
0:06
as an expression.
0:10
A function declaration, for example,
defines a function using the function
0:11
keyword followed by
the name of the function.
0:15
And a function expression
is an anonymous function or
0:17
a function without a name
that's assigned to a variable.
0:21
In this stage, I'll teach you another
method for writing functions.
0:24
You'll learn how arrow functions provide
a special more concise syntax for
0:28
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