Skip to content

Commit 2fe1490

Browse files
committed
docs(object): edit object
1 parent 76e1b1a commit 2fe1490

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/object.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ let emptyObject = { ...null, ...undefined }; // 不报错
11911191
let aWithXGetter = {
11921192
...a,
11931193
get x() {
1194-
throws new Error('not thrown yet');
1194+
throw new Error('not throw yet');
11951195
}
11961196
};
11971197

@@ -1200,7 +1200,7 @@ let runtimeError = {
12001200
...a,
12011201
...{
12021202
get x() {
1203-
throws new Error('thrown now');
1203+
throw new Error('throw now');
12041204
}
12051205
}
12061206
};

docs/regex.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ JavaScript 语言的正则表达式,只支持先行断言(lookahead)和先
367367
/\d+(?!%)/.exec('that’s all 44 of them') // ["44"]
368368
```
369369

370-
上面两个字符串,如果互换正则表达式,就会匹配失败。另外,还可以看到,”先行断言“括号之中的部分(`(?=%)`),是不计入返回结果的。
370+
上面两个字符串,如果互换正则表达式,就不会得到相同结果。另外,还可以看到,”先行断言“括号之中的部分(`(?=%)`),是不计入返回结果的。
371371

372372
“后行断言”正好与“先行断言”相反,`x`只有在`y`后面才匹配,必须写成`/(?<=y)x/`。比如,只匹配美元符号之后的数字,要写成`/(?<=\$)\d+/`。”后行否定断言“则与”先行否定断言“相反,`x`只有不在`y`后面才匹配,必须写成`/(?<!y)x/`。比如,只匹配不在美元符号后面的数字,要写成`/(?<!\$)\d+/`
373373

0 commit comments

Comments
 (0)