From d7a7e89cf35a3c570a4cd7eb3c47f2f9e8cc79a4 Mon Sep 17 00:00:00 2001 From: Leon Xu <6479451-leonxu260@users.noreply.gitlab.com> Date: Thu, 9 Sep 2021 13:00:13 -0700 Subject: [PATCH] doc: create this section --- source/_posts/this关键字.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/_posts/this关键字.md b/source/_posts/this关键字.md index 8451cd8..bf3faba 100644 --- a/source/_posts/this关键字.md +++ b/source/_posts/this关键字.md @@ -16,3 +16,17 @@ abbrlink: 75f5b5c3 - 例如,parseInt函数调用是parseInt('15')。 - 调用的上下文是函数体中的值。 - 函数的作用域是函数体中可访问的变量和函数的集合。 + +# this +在“标准”语言中,这是当前对象的实例 +```java +public int compareTo(Object other) { + return this - other; +} +``` + +在JavaScript中,这是函数调用的上下文 +- 函数调用:alert('Hello World!') +- 方法调用:console.log('Hello World!') +- 构造函数调用:new RegExp ('d') +- 间接调用:alert.call(undefined, 'Hello World!') \ No newline at end of file