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
Rest Operator for Objects
Now we can use rest on the properties of an Object. It allows us to explicitly extract certain named variables, and assign any uncalled variables into a catchall Object.
Remove array of objects from another array of objects
Remove array of objects from another array of objects
Sử dụng Promise.all với fetch
Sử dụng Promise.all hiệu quả sẽ làm cho hiệu suất của code chúng ta tăng lên đáng kể. Và mã sau đây giúp các bạn có thể get được nhiều data mà không ảnh hưởng tới performance.
10 mẹo sử dụng array và object trong javascript
10 mẹo sử dụng array và object trong 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ì?