Skip to content

Commit

Permalink
Translation zh-TW answer 104
Browse files Browse the repository at this point in the history
  • Loading branch information
sexyoung committed Jul 2, 2021
1 parent 7c33e1b commit 7132b39
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions zh-TW/README_zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -3313,4 +3313,27 @@ for (let item of set) {
</p>
</details>

---
###### 104. 將得到什麼

```javascript
Promise.resolve(5)
```

- A: `5`
- B: `Promise {<pending>: 5}`
- C: `Promise {<fulfilled>: 5}`
- D: `Error`

<details><summary><b>答案</b></summary>
<p>

#### 答案: C

我們可以將我們想要的任何類型的值傳遞`Promise.resolve`,無論是否`promise`。該函數本身返回帶有已解析值的`Promise` (`<fulfilled>`)。如果您傳遞正規式函數,它將是具有正規式值的已解決`promise`。如果你通過了promise,它將是一個已經resolved的且帶有傳的值的promise。

上述情況,我們傳了數字5,因此返回一個resolved狀態的promise,resolve值為`5`

</p>
</details>
---

0 comments on commit 7132b39

Please sign in to comment.