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)