art-of-node | : snowflake : a short introduction to node.js
kandi X-RAY | art-of-node Summary
kandi X-RAY | art-of-node Summary
This document is intended for readers who know at least a little bit of a couple of things:.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- add number
- takes a callback and calls the callback
- Call after callback .
- Logs a number to the console
art-of-node Key Features
art-of-node Examples and Code Snippets
Community Discussions
Trending Discussions on art-of-node
QUESTION
i'm trying to understand asynchronous callbacks in NodeJS by following this guide and i have a question about the position of callback()
in the code snippet below.
ANSWER
Answered 2017-Aug-23 at 09:08Your thinking is right. Node.js executes fs.readFile
but DOES NOT wait for it's completion.
So the execution moves to next statement, which invokes the callback and the result is undefined
because the previous command has not yet finished.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install art-of-node
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page