I'm working on learning Node.js and all I hear in every tutorial is "Node is asynchronous and no -blocking!"
I've heard in regular browser JavaScript only certain things such as AJAX calls can be made asynchronous or non-blocking (using callbacks)... Is this true of Node.js as well, or are all Node.js callback functions made asynchronous/non-blocking?
are all Node.js callback functions made asynchronous/non-blocking?
No. Only I/O is usually asynchronous, but many other callbacks are synchronous. Always check the docs.
Examples of async functions:
setTimeout
)process.nextTick
, setImmediate
Examples of sync callbacks:
forEach
sort
comparator callbacksreplace
match callbacksSee also Are all javascript callbacks asynchronous? If not, how do I know which are? (including some other examples).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With