Discuss / JavaScript / 写给新人

写给新人

Topic source

王政亮WZL

#1 Created at ... [Delete] [Delete and Lock User]
function multiply(input) {
    return new Promise(function (resolve, reject) {
        log('calculating ' + input + ' x ' + input + '...');
        setTimeout(resolve, 500, input * input);
    });
}

SetTimeOut() 第三个参数用法,即 input * input 将作为回调函数的参数 input 传入

廖雪峰

#2 Created at ... [Delete] [Delete and Lock User]

上面的用法注意IE<=9不支持


  • 1

Reply