Skip to content

Commit c80e606

Browse files
committed
docs(stdlib): fix json/stringify
1 parent 738008d commit c80e606

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/stdlib/json.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ RegExp.prototype.toJSON = RegExp.prototype.toString;
332332
JSON.stringify(/foo/) // ""/foo/""
333333
```
334334

335-
上面代码在正则对象的原型上面部署了`toJSON`方法,将其指向`toString`方法,因此遇到转换成`JSON`,正则对象就先调用`toJSON`方法转为字符串,然后再被`JSON.stingify`方法处理。
335+
上面代码在正则对象的原型上面部署了`toJSON()`方法,将其指向`toString()`方法,因此转换成 JSON 格式时,正则对象就先调用`toJSON()`方法转为字符串,然后再被`JSON.stringify()`方法处理。
336336

337337
## JSON.parse()
338338

0 commit comments

Comments
 (0)