Skip to content

Commit

Permalink
Update index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yin1999 authored Oct 30, 2024
1 parent b2f3c13 commit 57d1ccf
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const notFalsyText = myText || "Hello world";
console.log(notFalsyText); // Hello world

const preservingFalsy = myText ?? "Hi neighborhood";
console.log(preservingFalsy); // '' (myText 既不是 undefined 也不是 null)
console.log(preservingFalsy); // ''myText 既不是 undefined 也不是 null
```
### 短路
Expand Down Expand Up @@ -143,4 +143,4 @@ console.log(foo.someBarProp?.toUpperCase() ?? "not available"); // "not availabl
- [逻辑空赋值运算符(`??=`)](/zh-CN/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_assignment)
- [可选链运算符(`?.`)](/zh-CN/docs/Web/JavaScript/Reference/Operators/Optional_chaining)
- [逻辑或运算符(`||`)](/zh-CN/docs/Web/JavaScript/Reference/Operators/Logical_OR)
- [函数中的默认参数值](/zh-CN/docs/Web/JavaScript/Reference/Functions/Default_parameters)
- [默认参数](/zh-CN/docs/Web/JavaScript/Reference/Functions/Default_parameters)

0 comments on commit 57d1ccf

Please sign in to comment.