using async/await to catch errors
javascript,es6,object,web_development
async function executeAsyncTask () {
try {
const valueA = await functionA();
const valueB = await functionB(valueA);
const valueC = await functionC(valueB);
return await functionD(valueC);
}
catch (err) {
logger.error(err);
} finally {
await alwaysExecuteThisFunction();
}
}Có thể bạn đã miss một số snippets code
Toán tử trong javascript - Version đầy đủ
Toán tử trong javascript là một bước đệm cho việc học lập trình sau này. Và đây là version đầy đủ cho bạn.
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.
10 mẹo sử dụng array và object trong javascript
10 mẹo sử dụng array và object trong javascript
serialize Form
Sử dụng formdata constructor để convert form, FormData, array.from(). Kết hợp window.encodeURIComponent() để encode từng value trong form.
Object.fromEntries
Object.fromEntries Là một phương thức mới được giới thiệu trong ES10 được sử dụng để chuyển đổi từ list có dạng key và value thành những objects.