OpenSource For You

Promise

-

Promise is a place holder for a future value. This is because we want to store the results of an asynchrono­us operation. Promise is an object. The syntax below is used to create a Promise. The syntax is: Given below is an example of how to create a function that returns a Promise. We have converted an asynchrono­us fs.readFile() operation into a Promise.

Newspapers in English

Newspapers from India