...

/

Solution Review: `this` Keyword

Solution Review: `this` Keyword

In this lesson, we will discuss the solutions to the questions in the previous lesson.

Question 1: Solution review #

In the previous lesson, you were given the following code:

Press + to interact
length = 10;
function func() {
console.log(this.length);
}
var obj = {
length: 5,
thisFunc: function(func) {
func();
arguments[0]();
}
};
obj.thisFunc(func, 3);

For the code above, you had to answer the following question:

Explanation #

The solution is given below.

Console

As you can see, Option D is the correct answer. Let’s discuss the code to understand the answer.

Let’s start from line 14, where we are calling obj.thisFunc. ...

Access this course and 1400+ top-rated courses and projects.