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
Remove item in array javascript es6
Những bạn nào mà đã sử dụng ES6 một thời gian rồi thì có thể sử dụng method array.filter()
try/catch es10
An update for developer convience allows the use of try/catch without an explicit e Error reference in the catch call.
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ư:
Extend Object javascript
Extend Object javascript
Random String
Random String với độ dài tuỳ chọn