Async await in javascript

async,tipjs,function

const fs = require('fs')
async function readFile() {
  try {    
    var f1 = await readFileWithPromise('/etc/passwd')
    console.log(f1.toString())
    var f2 = await readFileWithPromise('/etc/profile')
    console.log(f2.toString())
  } catch (err) {
    console.log(err)
  }
}

Có thể bạn đã miss một số snippets code

JavaScript: async/await with forEach

JavaScript: async/await with forEach()

Await in a for loop

How to Await in a for loop

Sử dụng reduce và concat làm phẳng một array

Array.reduce() và Array.concat() có thể giúp chúng ta làm phẳng một Array như:

Random Number javascript

Random Number javascript

Sự khác biệt giữa substr và substring

Sự khác biệt giữa substr() và substring() chức năng trong JS là gì?