Skip to content

Fix minor typo #1250

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

Merged
merged 1 commit into from
Aug 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 1-js/99-js-misc/01-proxy/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ dictionary = new Proxy(dictionary, {
*!*
get(target, phrase) { // 拦截读取属性操作
*/!*
if (phrase in target) { //如果词典中有该短语
if (phrase in target) { // 如果词典中有该短语
return target[phrase]; // 返回其翻译
} else {
// 否则返回未翻译的短语
Expand Down Expand Up @@ -934,7 +934,7 @@ Proxy 可以拦截许多操作符,例如 `new`(使用 `construct`),`in`

假设我们有一个资源,并且想随时关闭对该资源的访问。

我们可以做的是将它包装成可一个撤销的代理,没有任何捕捉器。这样的代理会将操作转发给对象,并且我们可以随时将其禁用。
我们可以做的是将它包装成一个可撤销的代理,没有任何捕捉器。这样的代理会将操作转发给对象,并且我们可以随时将其禁用。

语法为:

Expand Down