Skip to content

fix: typo #1188

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 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ alert(height ?? 100); // 0

## 优先级

`??` 运算符的优先级与 `||` 相同,它们的的优先级都为 `4`,详见:[MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table)。
`??` 运算符的优先级与 `||` 相同,它们的优先级都为 `4`,详见:[MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table)。

这意味着,就像 `||` 一样,空值合并运算符在 `=` 和 `?` 运算前计算,但在大多数其他运算(例如 `+` 和 `*`)之后计算。

Expand Down
2 changes: 1 addition & 1 deletion 1-js/05-data-types/03-string/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ let guestList = "Guests: // Error: Unexpected token ILLEGAL
* John";
```

单引号和双引号来自语言创建的的古老时代,当时没有考虑到多行字符串的需要。反引号出现较晚,因此更通用。
单引号和双引号来自语言创建的古老时代,当时没有考虑到多行字符串的需要。反引号出现较晚,因此更通用。

反引号还允许我们在第一个反引号之前指定一个“模版函数”。语法是:<code>func&#96;string&#96;</code>。函数 `func` 被自动调用,接收字符串和嵌入式表达式,并处理它们。你可以在 [docs](mdn:/JavaScript/Reference/Template_literals#Tagged_template_literals) 中阅读更多关于它们的信息。这叫做 "tagged templates"。此功能可以更轻松地将字符串包装到自定义模版或其他函数中,但这很少使用。

Expand Down
2 changes: 1 addition & 1 deletion 1-js/05-data-types/12-json/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ replacer
: 要编码的属性数组或映射函数 `function(key, value)`。

space
: 用于格式化的空格数量
: 用于格式化的空格数量

大部分情况,`JSON.stringify` 仅与第一个参数一起使用。但是,如果我们需要微调替换过程,比如过滤掉循环引用,我们可以使用 `JSON.stringify` 的第二个参数。

Expand Down
2 changes: 1 addition & 1 deletion 1-js/08-prototypes/04-prototype-methods/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ alert(Object.keys(chineseDictionary)); // hello,bye
- [Object.getPrototypeOf(obj)](mdn:js/Object/getPrototypeOf) —— 返回对象 `obj` 的 `[[Prototype]]`(与 `__proto__` 的 getter 相同)。
- [Object.setPrototypeOf(obj, proto)](mdn:js/Object/setPrototypeOf) —— 将对象 `obj` 的 `[[Prototype]]` 设置为 `proto`(与 `__proto__` 的 setter 相同)。

- 不推荐使用内建的的 `__proto__` getter/setter 获取/设置原型,它现在在 ECMA 规范的附录 B 中。
- 不推荐使用内建的 `__proto__` getter/setter 获取/设置原型,它现在在 ECMA 规范的附录 B 中。

- 我们还介绍了使用 `Object.create(null)` 或 `{__proto__: null}` 创建的无原型的对象。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ async function* fetchCommits(repo) {

## 总结

常规的 iterator 和 generator 可以很好地处理那些不需要花费时间来生成的的数据
常规的 iterator 和 generator 可以很好地处理那些不需要花费时间来生成的数据

当我们期望异步地,有延迟地获取数据时,可以使用它们的异步版本,并且使用 `for await..of` 替代 `for..of`。

Expand Down
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 @@ -344,7 +344,7 @@ alert(user._password); // secret
- `get` 读取此类属性时抛出错误,
- `set` 写入属性时抛出错误,
- `deleteProperty` 删除属性时抛出错误,
- `ownKeys` 在使用 `for..in` 和像 `Object.keys` 这样的的方法时排除以 `_` 开头的属性。
- `ownKeys` 在使用 `for..in` 和像 `Object.keys` 这样的方法时排除以 `_` 开头的属性。

代码如下:

Expand Down Expand Up @@ -726,7 +726,7 @@ alert(admin.name); // 输出:Guest (?!?)

问题实际上出在代理中,在 `(*)` 行。

1. 当我们读取 `admin.name` 时,由于 `admin` 对象自身没有对应的的属性,搜索将转到其原型。
1. 当我们读取 `admin.name` 时,由于 `admin` 对象自身没有对应的属性,搜索将转到其原型。
2. 原型是 `userProxy`。
3. 从代理读取 `name` 属性时,`get` 捕捉器会被触发,并从原始对象返回 `target[prop]` 属性,在 `(*)` 行。

Expand Down
2 changes: 1 addition & 1 deletion 1-js/99-js-misc/04-reference-type/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
```warn header="深入的语言特性"
本文所讲的是一个高阶主题,能帮你更好地理解一些边缘情况。

这仅是锦上添花。许多经验丰富的的开发者不甚了了也过得不错。如果你想了解代码运行的本质,那就继续读下去吧。
这仅是锦上添花。许多经验丰富的开发者不甚了了也过得不错。如果你想了解代码运行的本质,那就继续读下去吧。
```

一个动态执行的方法调用可能会丢失 `this`。
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,21 @@
```

```md
`ReadableStream` objects 允許一个个资料块(chunk)地读取资料。
`ReadableStream` objects 允许一个个资料块(chunk)地读取资料。
```


### 标点符号

- 本教程标点符号格式采用 [此份指南](https://github.com/sparanoid/chinese-copywriting-guidelines)。
- 资料链接、**增強**,都须 [留下空白](https://github.com/sparanoid/chinese-copywriting-guidelines#%E9%8F%88%E6%8E%A5%E4%B9%8B%E9%96%93%E5%A2%9E%E5%8A%A0%E7%A9%BA%E6%A0%BC)。
- 资料链接、**粗体**,都须 [留下空白](https://github.com/sparanoid/chinese-copywriting-guidelines#%E9%8F%88%E6%8E%A5%E4%B9%8B%E9%96%93%E5%A2%9E%E5%8A%A0%E7%A9%BA%E6%A0%BC)。
- 中文无斜体形式,英文的斜体翻译至中文改为 **加粗**。

- 斜线号 `/` 较为特殊,若用于分隔两同类型词条时,请维持半形斜线且两侧不加空白,**但在词汇们整体的前后要留一空白做分隔:**
- `Increment/decrement can only be applied to variables.`:`递增/递减 只能被套用在变量上。`
- `If the result of increment/decrement is not used, ...`:`如果 递增/递减 的結果没被使用,...`

- 语一句话只能有一个逗号,但中文无此限制,可依据语气通顺程度将一些英文句点转为逗号。
- 英文一句话只能有一个逗号,但中文无此限制,可依据语气通顺程度将一些英文句点转为逗号。

- 列举项目后的文字需加句号。<- 像这样

Expand Down