Using promises to catch errors

javascript,es6,object,web_development

return functionA()
  .then(functionB)
  .then(functionC)
  .then(functionD)
  .catch((err) => logger.error(err))
  .then(alwaysExecuteThisFunction)

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

Calculate the number of difference days between two dates

Calculate the number of difference days between two dates

Await in a for loop

How to Await in a for loop

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.

Rolling loading

Nguyên tắc là theo dõi các sự kiện cuộn trang và phân tích mối quan hệ thuộc tính giữa clientHeight , scrollTop và scrollHeight .

parse javascript Example

The JSON.parse() method parses a JSON string, constructing the JavaScript value or object described by the string