• Register
Welcome to Developerhelpway Q&A, where you can ask questions and receive answers from other members of the community.

What are Promises

0 votes
12 views
What are Promises in node.js?
asked Aug 15 in Node.js by Himanshu

1 Answer

0 votes
Promises are the concurrency primitive. Promises are the part of most modern programming languages to make programming life easier. Promises can help us to handle async operations in better way.

Example:- Following code 1000ms prints out the result string in standard output.

new Promise((resolve, reject) => {
  setTimeout(() => {
    resolve('result')
  }, 1000)
})
  .then(console.log)
  .catch(console.error)
answered Oct 5 by Developerhelpway (1,000 points)
...