请你编写一个异步函数,它接收一个正整数参数 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. 吃透 JVM 诊断方法与工具使用

    JVM(Java虚拟机)是Java程序运行的基础环境,它提供了内存管理.线程管理和性能监控等功能.吃透JVM诊断方法,可以帮助开发者更有效地解决Java应用在运行时遇到的问题.以下是一些常见的JVM诊 ...

  2. Cesium 实现可视域分析

    *前言:尝试了网上好多个版本的可视域分析,感觉都有一些问题,我这个也可能不是最完美的,但是我觉得对我来说够用了,实现效果如下* 此示例基于vue3上实现,cesium版本1.101.0 ,vite-p ...

  3. 【ELK】Kibana-7.13.1版本 启动报错 Centos6

    报错信息: [root@centos6-1 gcc-4.8.2]# /opt/kibana-7.13.1-linux-x86_64/bin/kibana /opt/kibana-7.13.1-linu ...

  4. 【C3】05 层叠与继承

    本文旨在让你理解CSS的一些最基本的概念 --层叠.优先级和继承-- 这些概念决定着如何将CSS应用到HTML中,以及如何解决冲突. 尽管与课程的其他部分相比,完成这节课可能看起来没有那么直接的相关性 ...

  5. 支持NVIDIA GPU —— 如何运行docker环境下的Jax环境

    项目地址: https://github.com/NVIDIA/JAX-Toolbox 具体的安装命令: 地址: https://github.com/NVIDIA/JAX-Toolbox/pkgs/ ...

  6. gpg 密钥的导入、导出

    参考: gpg 密钥生成.导入.导出.自动输入密码 How do I delete secret subkeys correctly? 注意: 本文不对GPG的操作做详细介绍,有深入了解者自行参考:g ...

  7. NVRM: Xid (PCI:0000:b1:00): 13, pid=1375637, Graphics SM Global Exception on (GPC 0, TPC 1, SM 1): Multiple Warp Errors

    显卡服务器中一个显卡崩溃了: May 16 05:38:58 dell kernel: [14244871.006970] NVRM: Xid (PCI:0000:b1:00): 13, pid=13 ...

  8. 下一代浏览器和移动自动化测试框架:WebdriverIO

    1.介绍 今天给大家推荐一款基于Node.js编写且号称下一代浏览器和移动自动化测试框架:WebdriverIO 简单来讲:WebdriverIO 是一个开源的自动化测试框架,它允许测试人员使用 No ...

  9. 神经网络之卷积篇:详解三维卷积(Convolutions over volumes)

    详解三维卷积 从一个例子开始,假如说不仅想检测灰度图像的特征,也想检测RGB彩色图像的特征.彩色图像如果是6×6×3,这里的3指的是三个颜色通道,可以把它想象成三个6×6图像的堆叠.为了检测图像的边缘 ...

  10. async await 状态机理解

    public async Task<string> Wait3S() { await Task.Delay(3000); Console.WriteLine("Wait 3 S& ...