7-11 leetcode 2612
请你编写一个异步函数,它接收一个正整数参数 millis ,并休眠这么多毫秒。要求此函数可以解析任何值。
ps: promise 期约函数 (异步函数)的使用 ,promise 是一个对象 new promise
/**
* @param {number} millis
*/
async function sleep(millis) {
// 返回一个异步函数 a 就是millis时间后返回的函数
return new Promise(a => setTimeout(a,millis))
} /**
* let t = Date.now()
* sleep(100).then(() => console.log(Date.now() - t)) // 100
*/
7-11 leetcode 2612的更多相关文章
- 11. leetcode 283. Move Zeroes
Given an array nums, write a function to move all 0's to the end of it while maintaining the relativ ...
- [LintCode] Divide Two Integers 两数相除
Divide two integers without using multiplication, division and mod operator. If it is overflow, retu ...
- 地区sql
/*Navicat MySQL Data Transfer Source Server : localhostSource Server Version : 50136Source Host : lo ...
- LeetCode 11. Container With Most Water (装最多水的容器)
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). ...
- 2017/11/22 Leetcode 日记
2017/11/22 Leetcode 日记 136. Single Number Given an array of integers, every element appears twice ex ...
- 2017/11/21 Leetcode 日记
2017/11/21 Leetcode 日记 496. Next Greater Element I You are given two arrays (without duplicates) num ...
- 2017/11/13 Leetcode 日记
2017/11/13 Leetcode 日记 463. Island Perimeter You are given a map in form of a two-dimensional intege ...
- 2017/11/20 Leetcode 日记
2017/11/14 Leetcode 日记 442. Find All Duplicates in an Array Given an array of integers, 1 ≤ a[i] ≤ n ...
- 2017/11/9 Leetcode 日记
2017/11/9 Leetcode 日记 566. Reshape the Matrix In MATLAB, there is a very useful function called 'res ...
- 2017/11/7 Leetcode 日记
2017/11/7 Leetcode 日记 669. Trim a Binary Search Tree Given a binary search tree and the lowest and h ...
随机推荐
- 【DataBase】MySQL 13 分组查询
视频参考自:P59 - P68 https://www.bilibili.com/video/BV1xW411u7ax 分组查询 GROUP BY -- group by 子句 -- 要注意!grou ...
- 【DataBase】MySQL 02 MySQL的配置详细
参考至视频:P8 - P11部分 https://www.bilibili.com/video/BV1xW411u7ax 配置文件的介绍 最基本的只需要这三项就行了,演示的其他配置在新版都不支持了貌似 ...
- 【DataBase】SQL优化案例:其一
原始SQL: 这里想做的事情就是查询一周的一个计算值 可以理解为报表的那种 主表 t_wechat_clue 生产库上200万数据量 然后需要联表一些限制条件 SELECT IFNULL(SUM((C ...
- 【Vue】12 VueRouter Part2 路由与传参
[编程式导航] 我们希望在路由跳转之前执行某一些功能... <template> <div id="app"> <h2>这是App.vue组件的 ...
- 伪代码中ties broken arbitrarily是什么含义?
最近在看一个物联网的论文,论文的伪代码中有这么一个地方标有:ties broken arbitrarily,对这个写法有些搞不清楚含义,于是网上找到了下面的资料: https://www.zhihu. ...
- 3.2.0 版本预告!远程日志解决 Worker 故障获取不到日志的问题
Apache DolphinScheduler 3.2.0 版本已经呼之欲出,8 月 中下旬,这个大版本就要和用户见面了.为了让大家提前了解到此版本更新的主要内容,我们已经制作了几期视频和内容做了大致 ...
- 无缝融入,即刻智能[一]:Dify-LLM大模型平台,零编码集成嵌入第三方系统,42K+星标见证专属智能方案[含ollama部署]
无缝融入,即刻智能[一]:Dify-LLM大模型平台,零编码集成嵌入第三方系统,42K+星标见证专属智能方案 1.Dify 简介 1.1 功能情况 Dify,一款引领未来的开源大语言模型(LLM)应用 ...
- Dijkstra单源最短路模板
struct DIJ { using i64 = long long; using PII = pair<i64, i64>; vector<i64> dis; vector& ...
- 瑞芯微-I2S | 音频驱动调试基本命令和工具-基于rk3568-2
基于Linux嵌入式设备常用调试方法很多,本文一口君把调试语音用到的工具和方法给大家做一个简单的介绍. 1. procfs.sysfs Linux系统上的/proc目录是一种文件系统,即proc文件系 ...
- ubuntu18.04 heirloom-mailx 通过外部SMTP服务器发送邮件
配置软件源ubuntu18.04上无法直接安装heirloom-mailx,需要添加软件源 sudo vi /etc/apt/sources.list写入 deb http://cz.archive. ...