当前位置:网站首页>ES7 - Optimization of promise
ES7 - Optimization of promise
2022-07-03 18:12:00 【Bump】
Optimize Promise
stay es6 Optimization based on
grammar
key word :async
// key word async Return value Promise object
async function task1(){
return 'task1 ... Successful implementation ';
}
The return value is Promise object
simplify then()
key word :await
notes : Use await There has to be async Modify function
Example
async function task2(){
return 'task2 ... Successful implementation ';
}
async function task3(){
return 'task3 ... Successful implementation ';
}
//es7 await simplify then() notes : Use await There has to be async Modify function
async function test(){
let ret1=await task1();
console.log('es7-->'+ret1);
let ret2=await task2();
console.log('es7-->'+ret2);
let ret3=await task3();
console.log('es7-->'+ret3);
}
test();
Es7 Yes Promise The optimization of is completed by practice
边栏推荐
- English语法_名词 - 分类
- 网格图中递增路径的数目[dfs逆向路径+记忆dfs]
- PHP processing - watermark images (text, etc.)
- WebView module manages the application window interface to realize the logical control and management operation of multiple windows (Part 1)
- PHP MySQL create database
- [combinatorics] generating function (use generating function to solve the number of solutions of indefinite equation)
- The third day of writing C language by Yabo people
- Getting started with deops
- Market demand survey and marketing strategy analysis report of global and Chinese pet milk substitutes 2022-2028
- Research Report on competitive strategy Outlook Analysis and investment strategic planning of China's smart home equipment industry, 2022-2028
猜你喜欢
On Data Mining
Lesson 13 of the Blue Bridge Cup -- tree array and line segment tree [exercise]
Computer graduation design PHP campus address book telephone number inquiry system
The third day of writing C language by Yabo people
基于人脸识别的课堂考勤系统 tkinter+openpyxl+face_recognition
面试官:值为 nil 为什么不等于 nil ?
Win32: dump file analysis of heap corruption
Computer graduation design PHP sports goods online sales system website
Global and Chinese pediatric palliative care drug market development research and investment planning recommendations report 2022-2028
Redis core technology and practice - learning notes (IX): slicing cluster
随机推荐
PHP MySQL create database
Getting started with deops
Lesson 13 of the Blue Bridge Cup -- tree array and line segment tree [exercise]
圖像24比特深度轉8比特深度
Micro service component sentinel console call
统计图像中各像素值的数量
PHP MySQL where clause
Computer graduation design PHP campus address book telephone number inquiry system
Module 9 operation
Sensor 调试流程
Image 24 bit depth to 8 bit depth
SDNUOJ1015
微服务组件Sentinel控制台调用
This diversion
Kotlin's collaboration: Context
Research Report on competitive strategy Outlook Analysis and investment strategic planning of China's smart home equipment industry, 2022-2028
Deops入门
English語法_名詞 - 分類
Change the single node of Postgres database into master-slave
[教程]在 CoreOS 上构建你的第一个应用