当前位置:网站首页>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
边栏推荐
- (9) Opencv Canny edge detection
- How to install PHP on Ubuntu 20.04
- Managing multiple selections with MVVM - managing multiple selections with MVVM
- Prototype inheritance..
- Postfix tips and troubleshooting commands
- Mature port AI ceaspectus leads the world in the application of AI in terminals, CIMC Feitong advanced products go global, smart terminals, intelligent ports, intelligent terminals
- PHP MySQL where clause
- [untitled]
- [combinatorics] generating function (use generating function to solve the number of solutions of indefinite equation example 2 | extended to integer solution)
- Should I be laid off at the age of 40? IBM is suspected of age discrimination, calling its old employees "dinosaurs" and planning to dismiss, but the employees can't refute it
猜你喜欢
Bloom filter [proposed by bloom in 1970; redis cache penetration solution]
What kind of experience is it when the Institute earns 20000 yuan a month?
win32:堆破坏的dump文件分析
Deops入门
Grammaire anglaise Nom - Classification
As soon as we enter "remote", we will never regret, and several people will be happy and several people will be sad| Community essay solicitation
面试官:值为 nil 为什么不等于 nil ?
聊聊支付流程的設計與實現邏輯
Lesson 13 of the Blue Bridge Cup -- tree array and line segment tree [exercise]
PHP MySQL preprocessing statement
随机推荐
聊聊支付流程的设计与实现逻辑
Enterprise custom form engine solution (12) -- form rule engine 2
Should I be laid off at the age of 40? IBM is suspected of age discrimination, calling its old employees "dinosaurs" and planning to dismiss, but the employees can't refute it
Module 9 operation
Basic grammar of interview (Part 2)
面试官:值为 nil 为什么不等于 nil ?
[combinatorics] generating function (positive integer splitting | unordered | ordered | allowed repetition | not allowed repetition | unordered not repeated splitting | unordered repeated splitting)
Website with JS doesn't work in IE9 until the Developer Tools is activated
[combinatorics] generating function (property summary | important generating function)*
PHP MySQL inserts multiple pieces of data
English语法_形容词/副词3级 - 倍数表达
Redis core technology and practice - learning notes (VIII) sentinel cluster: sentinel hung up
MySQL grouping query
[combinatorics] generating function (generating function application scenario | using generating function to solve recursive equation)
Computer graduation design PHP campus address book telephone number inquiry system
The third day of writing C language by Yabo people
圖像24比特深度轉8比特深度
STM32 realizes 74HC595 control
[combinatorics] generating function (summation property)
[combinatorics] generating function (positive integer splitting | unordered non repeated splitting example)