This course has been updated! We now recommend you take the Deep JavaScript Foundations, v3 course.

Check out a free preview of the full Deep JavaScript Foundations course:
The "Challenge 6: Solution" Lesson is part of the full, Deep JavaScript Foundations course featured in this preview video. Here's what you'd learn in this lesson:

Kyle walks through the solution to Challenge 6.

Get Unlimited Access Now

Transcript from the "Challenge 6: Solution" Lesson

>> Kyle Simpson: Okay, let's talk through the solution for exercise 6. As the readme indicates, essentially what we wanted to do is replace the hard coded lexical references to the helpers object with,
>> Kyle Simpson: This keyword. So here, we have helpers., and helpers., and helpers., we need to replace those with this keyword.

[00:00:23] So we this dot, this dot, this dot. Now, when we call Helpers.validateWorkEntry, for example, on line 93, what is that the this key we're gonna be inside of validateWorkEntry?
>> Speaker 2: Helpers?
>> Kyle Simpson: It's gonna be helpers. So when we go to that validateWorkEntry and it says this.minWorkDescriptionLength, where is it gonna find that on?

[00:00:51] It's gonna find that on the helpers object. So it makes a lot more sense for this to be this aware functions, so that they can pull those constant properties from their context object as opposed to pulling them from a lexical reference to helpers. Makes sense? Just one example of using this keyword.

[00:01:15] Questions about this? Remember the implicit binding role. When you see something like, just remember that's calling the foo function in the context of 02.