Await in a for loop
function,es6,async,tipjs
How to Await in a for loop
const forLoop = async _ => {
console.log('Start')
for (let index = 0; index < fruitsToGet.length; index++) {
const fruit = fruitsToGet[index]
const numFruit = await getNumFruit(fruit)
console.log(numFruit)
}
console.log('End')
}
//Use:
'Start'
'Apple: 27'
'Grape: 0'
'Pear: 14'
'End'
Có thể bạn đã miss một số snippets code
closure javascript
closure javascript
Chuyển đổi thời gian trong javascript
Sử dụng Object.entries(), Array.prototype.filter() và Array.prototype.map(). Trả về định dạng ngày, giờ, phút với một miliseconds đã cho.
jQuery on hover
Jquery on mouse over example.
kiểm tra email trong javascript
kiểm tra email trong javascript
Spread Operator for Objects
Using the spread operator during an Object declaration will assign the properties of the referenced Object to the new Object.