JavaScript this Keyword

未能成功加载,请稍后再试
0/0

In this lecture, we're going to have a closer look at the this keyword in JavaScript.

This is one of those features that confuses a lot of developers.

But honestly, I think it's because of the poor teaching materials out there, because I personally was confused about the this keyword for a long time.

So in this lecture, I'm going to make it super simple for you.

So you can explain it to your seven year old brother.

So what is this?

This references the object that is executing the current function.

Here I'm going to give you a very simple rule of thumb.

If that function is part of an object, we call that function a method, right?

So if that function is a method in an object, this references that object itself.

下载全新《每日英语听力》客户端,查看完整内容