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,Reflect.get的第三个参数 #338

Open
zzh-1999h opened this issue Dec 4, 2022 · 2 comments
Open

5.1节中理解Proxy和Reflect,Reflect.get的第三个参数 #338

zzh-1999h opened this issue Dec 4, 2022 · 2 comments

Comments

@zzh-1999h
Copy link

image

微信图片_20221204232915

@Liugq5713
Copy link

同好奇,有知道为什么的吗

@tangjian1891
Copy link

同好奇,有知道为什么的吗

我认为这里应该是写错了。根据mdn关于Reflect.get描述。第三个参数receiver为”如果target对象中指定了getter,receiver则为getter调用时的this值。“
下面这段代码可以印证mdn。
let obj = { age: 10, get getPersonAge() { return this.age; }, }; console.log(Reflect.get(obj, "getPersonAge", { age: 20 }));

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

3 participants