by
Q:
What are Promises?

1 Answer

0 votes
by

Promises are a concurrency primitive, first described in the 80s. Now they are part of most modern programming languages to make your life easier. Promises can help you better handle async operations.

An example can be the following snippet, which after 100ms prints out the result string to the standard output. Also, note the catch, which can be used for error handling. Promises are chainable.

new Promise((resolve, reject) => {

  setTimeout(() => {

    resolve('result')

  }, 100)

})

  .then(console.log)

  .catch(console.error)

Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

+1 vote
asked Mar 2, 2020 in React JS by RShastri
0 votes
asked Jul 2, 2019 in React JS by Venkatshastri
0 votes
+1 vote
asked Apr 11, 2020 in SAP by amita rallin
0 votes
asked Mar 18, 2020 in Selenium by Hodge
0 votes
asked Nov 29, 2019 in Machine Learning by SakshiSharma
...