请你编写一个异步函数,它接收一个正整数参数 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. exceptionx:灵活便捷的Python异常处理库,让异常处理更高效!

    exceptionx English | 中文 exceptionx 是一个灵活且便捷的Python异常处理库,允许你动态创建异常类,并提供多种异常处理机制. exceptionx 的前身是 gqyl ...

  2. 代码随想录Day2

    209.长度最小的子数组 给定一个含有 n 个正整数的数组和一个正整数 target . 找出该数组中满足其总和大于等于 target 的长度最小的 子数组 $ [nums_l, nums_{l+1} ...

  3. 【Java】 Void 类型

    void 也算一个类型,而且是基本数据类型 和其它数据类型一样提供了对应的包装类Void 每个包装类都提供一个TYPE字节实例,返回对应的原型类实例 public static void main(S ...

  4. 【WSDL】02 四种客户端调用方式

    WSDL概念和一些语法内容: https://www.w3school.com.cn/wsdl/index.asp SOAP概念: https://www.runoob.com/soap/soap-t ...

  5. 【Maven】概念知识

    怎么在Windows安装Maven https://www.cnblogs.com/mindzone/p/12701416.html 学到一个新的指令:查看相对系统变量 echo %XXX_HOME% ...

  6. bmp位图文件信息结构体

    /************************************************* * * file name:BmpInfoStruct.c * author :momolyl@1 ...

  7. Kotlin 面向对象编程 (OOP) 基础:类、对象与继承详解

    什么是面向对象编程 (OOP)? OOP 代表面向对象编程. 过程式编程是编写执行数据操作的过程或方法,而面向对象编程则是创建包含数据和方法的对象. 与过程式编程相比,面向对象编程具有以下几个优势: ...

  8. 运用Npcap库实现SYN半开放扫描

    Npcap 是一款高性能的网络捕获和数据包分析库,作为 Nmap 项目的一部分,Npcap 可用于捕获.发送和分析网络数据包.本章将介绍如何使用 Npcap 库来实现半开放扫描功能.TCP SYN 半 ...

  9. AtCoder Beginner Contest 313

    AtCoder Beginner Contest 313 - AtCoder A - To Be Saikyo (atcoder.jp) 从\(a_1 \dots a_{n-1}\)找出最大值与\(a ...

  10. [天线原理及设计>基本原理] 3. 辐射方向图或天线方向图

    <Antenna_Theory_Analysis_and_Design_3rd_Constantine_A._Balanis.pdf> 3. 辐射方向图或天线方向图 天线辐射方向图或天线方 ...