当前位置:网站首页>ES: Promise的基本用法
ES: Promise的基本用法
2022-08-02 16:59:00 【amadeus_liu2】
let myRandom=Math.floor(Math.random() * 10 );
var workIsDone=new Promise(
(resolve,reject) =>{
if(myRandom<5){
resolve("finished......")
}
else{
reject("ongoing......")
}
}
)
workIsDone.then(function(value) {
console.log("ok: "+value)
}, function(error) {
console.log("error: "+error);
});
边栏推荐
- DeepMind 首席科学家 Oriol Vinyals 最新访谈:通用 AI 的未来是强交互式元学习
- navicat premium 15 下载安装详细教程
- 年轻人接棒大妈,金价跌回“4字头”,七夕迎黄金消费小热潮
- 小心 transmittable-thread-local 的这个坑
- Navicat for mysql破解版安装
- JS数组删除其中一个元素
- 罗敏背后是抖音
- 2022年PMP考试应该注意些什么?
- [300+ selected big factory interview questions continue to share] Big data operation and maintenance sharp knife interview questions column (10)
- Default username and password (SQL)
猜你喜欢
随机推荐
Redis的介绍和使用
【C语言刷题】指针入门三题|字符串长度、字符串复制、两数交换
SQL语句基础
Smart Contract Security - delegatecall (1)
常用软件静默安装参数
Nacos配置中心用法详细介绍
安装TimeGen波形绘图软件
Arduino 硬件编程语言基础学习入门
Informatica旗下PowerCenter的元数据库解析
内网渗透之kerberos认证(三)
Red and blue against experience sharing: CS from kill posture
莱斯大学胡侠团队 ICML 2022 杰出论文: 新型图数据增强方法 G-Mixup|附作者对话
Redis的使用--集群模式
融云「 IM 进阶实战高手课」系列直播上线
【Redis】连接报错:Could not connect to Redis at 127.0.0.1:6379: Connection refused
蔚来杯2022牛客暑期多校训练营5 ABCDFGHK
金仓数据库KingbaseES安全指南--6.12. BSD身份验证
如何生成随机数+原理详细分析
Flink SQL搭建实时数仓DWD层
边界访问的空间权限









