0
Is the promise in javascript and node js are same?
6 odpowiedzi
0
Yes, more precisely it is in JS
0
Muhammadamin Alijonov so in JavaScript promises are used for making it asynchronous. But in nodejs, it is already asynchronous. So what is the purpose of promise in node js
0
For instance, we want to request 2 or more another API s from Backend, in this case we need to use Promises
0
See for more information
0
Ajmal K saleem Who said node is async by default? Node is a js runtime which uses the same V8 engine that we use in chrome.
There are two separate APIs for the Sync & Async calls in the node built in libs for almost everything.
Example:
- readFile
- readFileSync
but we generally use the readFile which is asynchronous because fs operation much be non blocking.