mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 18:32:22 +00:00
docs(string-methonds): fixed typo
This commit is contained in:
parent
a100783a99
commit
4c80184abe
@ -421,7 +421,7 @@ String.prototype.replaceAll(searchValue, replacement)
|
|||||||
|
|
||||||
上面例子中,`replaceAll()`的第二个参数是一个函数,该函数的返回值会替换掉所有`b`的匹配。
|
上面例子中,`replaceAll()`的第二个参数是一个函数,该函数的返回值会替换掉所有`b`的匹配。
|
||||||
|
|
||||||
这个替换函数可以接受多个参数。第一个参数是捕捉到的匹配内容,第二个参数捕捉到是组匹配(有多少个组匹配,就有多少个对应的参数)。此外,最后还可以添加两个参数,倒数第二个参数是捕捉到的内容在整个字符串中的位置,最后一个参数是原字符串。
|
这个替换函数可以接受多个参数。第一个参数是捕捉到的匹配内容,第二个参数是捕捉到的组匹配(有多少个组匹配,就有多少个对应的参数)。此外,最后还可以添加两个参数,倒数第二个参数是捕捉到的内容在整个字符串中的位置,最后一个参数是原字符串。
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const str = '123abc456';
|
const str = '123abc456';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user