docs(object): edit object

This commit is contained in:
ruanyf
2017-07-30 10:11:00 +08:00
parent 76e1b1a9d9
commit 2fe1490d27
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -1191,7 +1191,7 @@ let emptyObject = { ...null, ...undefined }; // 不报错
let aWithXGetter = {
...a,
get x() {
throws new Error('not thrown yet');
throw new Error('not throw yet');
}
};
@@ -1200,7 +1200,7 @@ let runtimeError = {
...a,
...{
get x() {
throws new Error('thrown now');
throw new Error('throw now');
}
}
};
+1 -1
View File
@@ -367,7 +367,7 @@ JavaScript 语言的正则表达式,只支持先行断言(lookahead)和先
/\d+(?!%)/.exec('thats all 44 of them') // ["44"]
```
上面两个字符串,如果互换正则表达式,就会匹配失败。另外,还可以看到,”先行断言“括号之中的部分(`(?=%)`),是不计入返回结果的。
上面两个字符串,如果互换正则表达式,就不会得到相同结果。另外,还可以看到,”先行断言“括号之中的部分(`(?=%)`),是不计入返回结果的。
“后行断言”正好与“先行断言”相反,`x`只有在`y`后面才匹配,必须写成`/(?<=y)x/`。比如,只匹配美元符号之后的数字,要写成`/(?<=\$)\d+/`。”后行否定断言“则与”先行否定断言“相反,`x`只有不在`y`后面才匹配,必须写成`/(?<!y)x/`。比如,只匹配不在美元符号后面的数字,要写成`/(?<!\$)\d+/`