若想自行建立 Fulfilled Promise,ECMAScript 提供了三種方式。
Version
macOS Catalina 10.15.5
VS Code 1.46.1
Quokka 1.0.306
ECMAScript 2020
Promise.resolve()
let f = x => Promise.resolve(x)
f(1) // ?
使用 Promise.resolve() static method 將 primitive 包成 Fulfilled Promise。

Promise Constructor
let f = x => new Promise(resolve => resolve(x))
f(1) // ?
也可以使用 resolve function 傳進 Promise Constructor 建立 Fulfilled Promise。

Asynchronous Function
let f = async x => x
f(1) // ?
最簡單的方式是在 function 前加上 async 成為 asynchronous function,則回傳值自動成為 Fulfilled Promise。

Conclusion
- 若想快速建立 Promise 供測試,則 asynchronous function 為最簡單方式