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
Ajax, call jQuery POST to node.js expressjs
Ajax, call jQuery POST to node.js expressjs
Filter Unique Values
Kiểu đối tượng Set đã được giới thiệu trong ES6 và cùng với ..., ‘spread’ operator, chúng ta có thể sử dụng nó để tạo một mảng mới chỉ với các giá trị duy nhất.
javascript rand
The Math.random() function returns a floating-point, pseudo-random number in the range 0 to less than 1
Get value select option JavaScript
How do I get the text value of a selected option and get value select option by Jquery.
Spread Operator for Objects
Using the spread operator during an Object declaration will assign the properties of the referenced Object to the new Object.