请你编写一个异步函数,它接收一个正整数参数 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的更多相关文章

  1. 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 ...

  2. [LintCode] Divide Two Integers 两数相除

    Divide two integers without using multiplication, division and mod operator. If it is overflow, retu ...

  3. 地区sql

    /*Navicat MySQL Data Transfer Source Server : localhostSource Server Version : 50136Source Host : lo ...

  4. LeetCode 11. Container With Most Water (装最多水的容器)

    Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai).  ...

  5. 2017/11/22 Leetcode 日记

    2017/11/22 Leetcode 日记 136. Single Number Given an array of integers, every element appears twice ex ...

  6. 2017/11/21 Leetcode 日记

    2017/11/21 Leetcode 日记 496. Next Greater Element I You are given two arrays (without duplicates) num ...

  7. 2017/11/13 Leetcode 日记

    2017/11/13 Leetcode 日记 463. Island Perimeter You are given a map in form of a two-dimensional intege ...

  8. 2017/11/20 Leetcode 日记

    2017/11/14 Leetcode 日记 442. Find All Duplicates in an Array Given an array of integers, 1 ≤ a[i] ≤ n ...

  9. 2017/11/9 Leetcode 日记

    2017/11/9 Leetcode 日记 566. Reshape the Matrix In MATLAB, there is a very useful function called 'res ...

  10. 2017/11/7 Leetcode 日记

    2017/11/7 Leetcode 日记 669. Trim a Binary Search Tree Given a binary search tree and the lowest and h ...

随机推荐

  1. DrawIO安装及基本使用教程

    1.DrawIO简介 DrawIO 是一款开源免费且功能强大的绘图工具,可以用于绘制流程图.组织结构图.网络图.UML图等各种类型的图表: DrawIO 支持多种文件格式,包括XML.PNG.SVG等 ...

  2. 算法·理论:KMP 学习笔记

    \(\text{KMP}\) 笔记! 上次比赛,出题人出了一个 \(\text{KMP}\) 模板,我敲了个 \(\text{SAM}\) 跑了,但是学长给的好题中又有很多 \(\text{KMP}\ ...

  3. 【Spring】01 快速入门

    Spring快速入门 空Maven项目创建 声明工程名称,完成 删除SRC目录,创建01 HelloSpring模块 导入依赖 Maven坐标: <!-- https://mvnreposito ...

  4. 何时使用交叉熵,何时使用KL散度:计算分布差距为啥使用KL散度而不用交叉熵,计算预测差距时为啥使用交叉熵而不用KL散度

    问题: 何时使用交叉熵,何时使用KL散度? 计算分布差距为啥使用KL散度而不用交叉熵,计算预测差距时为啥使用交叉熵而不用KL散度 问题很大,答案却很简单. 答案: 熵是一种量度,是信息不确定性的量度: ...

  5. 一款比较好用的 ssh、 ftp 服务的客户端软件 —— NxShell

    该软件地址: https://gitee.com/nxshell/nxshell 截图: ======================================================= ...

  6. 微信支付退款和退款结果查询接口简单实现(.Net 7.0)

    〇.前言 相较于支付宝,微信支付对 .Net 的支持就没那么充分,官方没有提供 SDK. 但值得庆幸的是,在社区有大佬封装了 v3 版 .Net SDK. 原文链接:https://developer ...

  7. nginx配置web服务|反向代理|负载均衡

    目录 http模块 server模块(虚拟主机配置) location模块 基本语法 匹配类型 等号匹配(=) 正则匹配(~) 忽略大小写的正则匹配(~*) 常见指令 嵌套 location 反向代理 ...

  8. 不同浏览器input file样式不一样

    在开发项目过程中会碰到不同浏览器input file样式不一样. 经过分析,打算都用IE上面的附件上传样式,  方案如下: 1.在IE下截个如上面的上传按钮,并保存. 2.判断浏览器类型,如果是非IE ...

  9. 2.3 Exception model

    2.3.1 异常状态 2.3.1 异常类型

  10. zabbix 4.0修改页面LOGO

    基本页面展示 一.Logo icon-sprite.svg是一个集合的图片,logo和一级菜单栏里面的图标是在这上面平移得到的 第一种方法 1.  zabbix安装好以后的默认LOGO如下: 2.   ...