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