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
Now that you've created an arrow function with no arguments, what does it look like with single and multiple arguments.
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
The arrow functions we've written so
far have had no arguments.
0:00
What do they look like
if there are arguments?
0:04
Let me show you.
0:07
First, let's create arrow functions
that take a single argument.
0:07
Open up the second JavaScript file and
0:12
we're going to modify
the functions square and cube.
0:15
For each function, let's set up variables
0:19
with appropriate names, square, And cube.
0:24
Next, remove the function keyword and
each of the function's names.
0:32
Finally, add arrows to
each of the functions.
0:41
As you can see,
0:47
the syntax is exactly the same with
a single argument as with no arguments.
0:48
Let's see what an arrow function
looks like with multiple arguments.
0:56
Open up the third file and let's convert
multiply into an arrow function.
1:02
Start by assigning the function
to a multiply constant variable.
1:08
Then, remove the function keyword and
the function name.
1:16
Finally, add the arrow.
1:22
There's also add and subtract here, these
need to be converted to arrow syntax too.
1:25
Why don't you convert these for practice?
1:31
In the next video,
1:34
we'll take a look at an even more
concise way to write arrow functions.
1:35
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