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
Find and debug errors in arrow function expression syntax.
Using Node in Workspaces
The instructor uses the Workspace console and the node
command to run and test their JavaScript file. Learn what that means.
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
Welcome back.
0:00
This is the final video in the practicing
Arrow functions syntax workshop.
0:01
You've made some awesome progress so far.
0:06
Hopefully by now,
0:08
you're feeling really confident in how
to correctly write Arrow functions.
0:09
But if not, that's totally okay.
0:13
Check the teacher's notes for
0:16
more information and
links back to the course material.
0:17
Keep working through these practices
videos as much as you need.
0:20
Ask questions in the community and
connect with other students.
0:23
Practicing and sometimes struggling is
all part of learning to be a programmer.
0:27
Okay, I bet your eager to see
the solutions for this file.
0:31
So let's jump in.
0:35
Our first function multiplyUs
is almost correct.
0:37
Were you able to see what was wrong?
0:41
If you noticed that our parameters
are missing their enclosing parenthesis,
0:43
then you really know your stuff.
0:47
Once we add those back in,
this function is complete.
0:49
Our second function, subtractFromTen
is missing a vital component.
0:52
The curly braces.
0:58
Without the curly braces, the console.log
is actually outside of our function.
0:59
In the global scope, this means that
our program won't be able to run.
1:05
Because our div variable which is
declared inside our function isn't in
1:10
the proper scope, and won't be accessible
when we try to log it to the console.
1:15
That was a tricky one.
1:21
Great work figuring that out.
1:22
And last but not least our function
printDate has two things wrong with it.
1:25
Were you able to identify both?
1:29
The first one was probably pretty obvious.
1:31
What's that function
keyword doing in there?
1:34
Arrow functions don't use
the function keyword.
1:37
So trying to include it will
cause unwanted behavior.
1:39
The second error in this function
may have been harder to notice.
1:43
But if you look closely,
you'll see that instead of an arrow,
1:47
is actually just an equal sign.
1:50
Oops, once we fixed that,
our debug.js file will run smoothly.
1:52
Let's give it a try.
1:58
Awesome, that looks perfect.
2:06
Well, congrats,
2:09
you just finished the practicing Arrow
functions syntax in JavaScript workshop.
2:10
Great job.
2:15
Keep up the good work, and keep on coding.
2:16
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