Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6746287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:18:17+00:00 2026-05-26T12:18:17+00:00

In beginner tutorials, Node’s non-blocking nature is usually demonstrated by showing a blocking example

  • 0

In beginner tutorials, Node’s non-blocking nature is usually demonstrated by showing a blocking example (using a return statement) and the non-blocking Node example (using callbacks). For an example, see here.

Should I take it as a “smell” that using return creates blocking code in my Node app, and find a way to redo it using callbacks?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:18:18+00:00Added an answer on May 26, 2026 at 12:18 pm

    TL;DR: if code may take a “long” time, it may be cleaner/more efficient to handle it with a callback.

    It’s not about return/not-return, it’s about what the code actually does.

    The example function doesn’t block because there’s a return, it blocks because db.query takes an arbitrary amount of time. If you want to do other things during that time, return right away, and do the result processing in the callback.

    Whether or not you should depends on what’s actually going on, what else may be affected by, or depend on, the data passed to the callback (or returned), and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have some useful beginner tutorials and code snippets for playing with basic
Beginner help needed :) I am doign an example form a php book which
I'm pretty new to Java and am following the Eclipse Total Beginner's Tutorials .
I am looking for some beginner tutorials for the newest release of JBox2D. The
Where can I find tutorials and other beginner-level learning material for developing Windows Mobile
I am a beginner to the ASP.Net MVC. After reading many tutorials and digesting
Possible Duplicate: OpenGL Beginner Tutorials Please let me know the name of OpenGl book
I watched the first 2 beginner tutorials for Ninject on dimecasts.net . Now, I
I'm a beginner to Ruby on Rails tutorials and the last thing I did
I know nothing about ruby. Do you know some beginner video tutorials for ruby?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.