简体   繁体   中英

Promise.reject().catch(console.log) got an `Illegal invocation` on my Android 5.1 phone

我以前在Chrome上尝试过此功能,但效果很好,但是在我的Android 5.1手机上,该Illegal invocation

In some browsers, console.log doesn't like being invoked in the global context. You can do one of these:

Promise.reject().then(function (error) {
   console.log(error);
});

or

Promise.reject().then(console.log.bind(console));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM