目前在offer评估中,说是九月底十月初出结果
for (var i = 0; i < 5; i++) {这样呢?
(function(i) {
setTimeout(() => {
console.log(i)
}, 1000 * i*)
})(i)
}
for (var i = 0; i < 5; i++) {
(function() {
setTimeout(() => {
console.log(i)
}, 1000 * i)
})(i)
}
setTimeout(() => {
console.log(1)
}, 0)
new Promise(resolve => {
console.log(2)
for (let i = 0; i < 10000; i++) {
if (i = 9999) {
resolve()
}
}
console.log(3)
}).then(() => {
console.log(4)
})
console.log(5)
const getData1 = async () => {
return await fetch('xxx')
}
const getData2 = () => {
return fetch('xxx')
}
const urls = ['url1', 'url2', 'url3']
const max = 2
const results = await requestMaxPool(urls, max)