Is there any way to know if a function is asynchronous or synchronous in node.js ? Thanks in advance.
2 Answers
You can guess by the function profile. But you can't be really sure. For example if a function ask a callback in a parameter or if it returns a promise, it's probably asynchronous.
But you have no way to be sure. A function can ask a callback and do a synchronous work. It can even returns a promise and still be synchronous.
You have to read the documentation to be sure.