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 Practice Arrow Functions in JavaScript!
You have completed Practice Arrow Functions in JavaScript!
Preview
Simplify and refactor three arrow function expressions.
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
Hi again.
0:00
Hope you're still having fun practicing
arrow functions syntax in JavaScript.
0:01
Let's jump right in to the solution for
the refactor.js style.
0:06
Our first function in this file,
multiplied by 10,
0:10
will run just fine, but
could be written more concisely.
0:14
Any ideas?
0:17
One thing we could do, is remove
the parentheses around the num parameter.
0:19
Because we're only passing in one
parameter, we don't need them, what else?
0:23
Well, because our function
only has one line of code,
0:28
we don't actually need our curly braces or
the return key word.
0:32
Our entire function can go on one line.
0:36
And what about our second function,
printToTen?
0:39
Did you struggle with this one at all?
0:41
Don't worry if you weren't able to
refactor this function to make it
0:44
more succinct.
0:47
You didn't miss anything.
0:48
This function is already
as short as it can be.
0:50
For our final function, addUs, we can
shorten this one a bit more by ditching
0:53
our curly braces and
putting our entire function on one line.
0:57
Awesome job refactoring these functions.
1:02
You should be feeling really
great about your work here.
1:04
If you have any questions about what we've
done so far in this practice session,
1:06
I definitely encourage you to connect with
other students in the TreeHouse community.
1:11
You'd be surprised how many other
students may have the exact same
1:15
questions that you do.
1:18
Okay, let's move on now to our last file,
debug.js.
1:20
This file contains three arrow functions
that all have some syntax errors.
1:25
Your goal is to debug these functions and
correct them, so
1:30
that they're using the correct syntax.
1:33
You'll know you've got it right
when your code runs without error.
1:35
Go ahead and give this a try.
When you're done,
1:39
head back to the fourth and final video
in this series to see the solution.
1:40
Good luck.
1:46
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