当前位置:网站首页>Promise.race learning (judging the fastest execution of multiple promise objects)
Promise.race learning (judging the fastest execution of multiple promise objects)
2022-08-11 06:34:00 【Chen Yangyu】
Promise.race learning
<script>/* Promise.race learning 1. Syntax: Promise.race (an array containing multiple Promise objects) 2. Return a new Promise object and change the object to be the first state to complete the PromiseNote: Here you can adjust the delay of setTimeout to experiment with Promise.race */var a =new Promise((resolve,reject)=>{setTimeout(() => {resolve("2s");}, 2000);})var b =new Promise((resolve,reject)=>{setTimeout(() => {reject('1s')}, 3000);})var race=Promise.race([a,b])console.log(race)</script>
边栏推荐
- openlayer中实现截图框截图的功能
- Argparse模块 学习
- PAT乙级刷题之路
- gerrit configure SSH Key and account, email information
- 品优购项目实战笔记
- Interpretation of the paper: GAN and detection network multi-task/SOD-MTGAN: Small Object Detection via Multi-Task Generative Adversarial Network
- The Summer of Open Source 2022 is coming | Welcome to sign up for the OpenMLDB community project~
- OpenMLDB + Jupyter Notebook:快速搭建机器学习应用
- OpenMLDB v0.5.0 released | Performance, cost, flexibility reach new heights
- vscode插件开发——代码提示、代码补全、代码分析(续)
猜你喜欢
STM32学习笔记(白话文理解版)—小灯的点亮、闪烁、呼吸
gerrit configure SSH Key and account, email information
场景驱动的特征计算方式OpenMLDB,高效实现“现算先用”
OpenMLDB Pulsar Connector: Efficiently connect real-time data to feature engineering
【无标题】
Day 77
Day 80
JS advanced web page special effects (pink teacher notes)
Interpretation of the paper: Cross-Modality Fusion Transformer for Multispectral Object Detection
gerrit 配置SSH Key和账号、邮箱信息
随机推荐
Manufacturer Push Platform-Huawei Access
Day 86
Intelligent risk control China design and fall to the ground
Byte (byte) and bit (bit)
USB 枚举过程中8 字节标准请求解析
使用c语言实现井字棋(有源码,可以直接运行)
Thesis unscramble TransFG: A Transformer Architecture for Fine - grained Recognition
STM32学习笔记(白话文理解版)—USART通信接口
STM32学习笔记(白话文理解版)—搞懂PWM输出
USB URB
[Meetup] OpenMLDBxDolphinScheduler engineering and scheduling link link characteristics, building the end-to-end MLOps workflow
js 学习进阶(Dom部分 pink老师教学笔记)
Simple mine sweeping in C language (with source code)
promise 改变状态的方法和promise 的then方法
字节(byte)和位(bit)
C语言中switch的嵌套
Compilation exception resolution
Promise.race学习(判断多个promise对象执行最快的一个)
The third phase of the contributor task is wonderful
The whole process of Tinker access --- Compilation