Skip to content
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/05-data-types/03-string/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ alert( str.indexOf('id', 2) ) // 12
```


如果我们对所以存在位置都感兴趣,可以在一个循环中使用 `indexOf`。每一次新的调用都发生在上一匹配位置之后:
如果我们对所有存在位置都感兴趣,可以在一个循环中使用 `indexOf`。每一次新的调用都发生在上一匹配位置之后:


```js run
Expand Down Expand Up @@ -342,7 +342,7 @@ if (~str.indexOf("Widget")) {

### includes, startsWith, endsWith

更现在的方法 [str.includes(substr, pos)](mdn:js/String/includes) 取决于 `str` 是否包含 `substr` 来返回 `true/false`。
更现代的方法 [str.includes(substr, pos)](mdn:js/String/includes) 取决于 `str` 是否包含 `substr` 来返回 `true/false`。

如果我们需要测试匹配,这是正确的选择,但不需要它的位置:

Expand Down