Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第五章:5.1 proxy&reflect #220

Open
mango2630 opened this issue May 13, 2024 · 1 comment
Open

第五章:5.1 proxy&reflect #220

mango2630 opened this issue May 13, 2024 · 1 comment

Comments

@mango2630
Copy link

Reflect.get 第三个参数作用描述错误。

image

在 target 对象指定 getter 情况下,才会有效 (如果target对象中指定了getter,receiver则为getter调用时的this值。)

image

测试 code

const obj = {
  trueAge: 12,
  get age() {
    return this.trueAge;
  }
}
console.log(Reflect.get(obj, 'age', { trueAge: 22 } ));
@firstblood93
Copy link

firstblood93 commented Aug 2, 2024

同样发现了 实际输出是 1 不是 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants