async

作者: 糖醋里脊120625 | 来源:发表于2020-09-22 15:58 被阅读0次
    
    function doubleAfter2seconds(num) {
              return new Promise((resolve, reject) => {
                setTimeout(() => {
                  resolve(2 * num)
                }, 2000);
              } )
            }
            async function timeout() {
              let result = await doubleAfter2seconds(30);
              console.log(result);
              return "是"
            }
    timeout().then(result => {
              console.log(result);
            })
    
    
    
    
    
    
    .......................................................
    var data = [
        'https://xxx.com/img/logo.jpg',
        'https://xxx.com/img/bg.jpg',
        'https://xxx.com/css/main.css',
        'https://xxx.com/css/animate.css',
        'https://xxx.com/js/jquery.js',
        'https://xxx.com/js/form.js',
    ]
    data.forEach(request)
    function request(url) {
     alert(url)
    }
    
    

    相关文章

      网友评论

          本文标题:async

          本文链接:https://www.haomeiwen.com/subject/wrbwyktx.html