[英]Uncaught TypeError: undefined is not a promise
I got error of Uncaught TypeError: undefined is not a promise
我得到了Uncaught TypeError: undefined is not a promise
错误Uncaught TypeError: undefined is not a promise
const p = Promise((resolve, reject) => {
resolve('ok')
})
p.then(resp => console.log(resp))
https://jsbin.com/daluquxira/edit?js,console,output https://jsbin.com/daluquxira/edit?js,console,output
what's wrong with above code? 上面的代码有什么问题?
You need to instantiate the Promise
. 您需要实例化Promise
。
In this case: 在这种情况下:
const p = new Promise((resolve, reject) => { resolve('ok') }) p.then(resp => console.log(resp))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.