当前位置:网站首页>async 与 await
async 与 await
2022-07-01 06:17:00 【HHYZBC】
async 函数
- 函数的返回值为 promise 对象
- promise 对象的结果由 async 函数执行的返回值决定
await 表达式
- await 右侧的表达式一般为 promise 对象, 但也可以是其它的值
- 如果表达式是 promise 对象, await 返回的是 promise 成功的值
- 如果表达式是其它值, 直接将此值作为 await 的返回值
注意
- await 必须写在 async 函数中, 但 async 函数中可以没有 await
- 如果 await 的 promise 失败了, 就会抛出异常, 需要通过 try...catch 捕获处理
由于我目前对前端学习的不是特别好,所以有关async 与 await更多信息看下面链接,
边栏推荐
- SystemVerilog learning-09-interprocess synchronization, communication and virtual methods
- Diffusion (multi-source search)
- ManageEngine卓豪助您符合ISO 20000标准(四)
- 【自动化运维】自动化运维平台有什么用
- SOE spatial analysis server MySQL and PostGIS geospatial database of Postgres anti injection attack
- JDBC connection pool
- 10-golang运算符
- webapck打包原理--启动过程分析
- UOW of dev XPO comparison
- B-tree series
猜你喜欢

Tidb single machine simulation deployment production environment cluster (closed pit practice, personal test is effective)

Freeswitch dial the extension number

指数法和Random Forest实现山东省丰水期地表水体信息

MongoDB:一、MongoDB是什么?MongoDB的优缺点

68 Cesium代码datasource加载czml

The row and column numbers of each pixel of multi-source grid data in the same area are the same, that is, the number of rows and columns are the same, and the pixel size is the same

High order binary balanced tree

Talking from mlperf: how to lead the next wave of AI accelerator

jdbc 数据库操作

Infinite horizontal marble game
随机推荐
FPGA - 7 Series FPGA internal structure clocking-01-clock Architecture Overview
Make: g++: command not found
JMM详解
分布式锁实现
XAF Bo of dev XPO comparison
【LeetCode】Day91-存在重复元素
SystemVerilog learning-07-class inheritance and package use
Recueillir des trésors dans le palais souterrain (recherche de mémoire profonde)
Diffusion (multi-source search)
【ManageEngine卓豪】用统一终端管理助“欧力士集团”数字化转型
可动的机械挂钟
JDBC database operation
ONEFLOW source code parsing: automatic inference of operator signature
Index method and random forest to realize the information of surface water body in wet season in Shandong Province
Picture server project test
Servlet
解决麒麟V10上传文件乱码问题
【ManageEngine】终端管理系统,助力华盛证券数字化转型
利用百度地图查询全国地铁线路
jdbc-连接池
https://blog.csdn.net/qq_40282016/article/details/118461230?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165493231716781683940327%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=165493231716781683940327&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-118461230-null-null.142^v13^control,157^v14^control&utm_term=async+%E4%B8%8E+await&spm=1018.2226.3001.4187