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