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 6898921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:21:23+00:00 2026-05-27T07:21:23+00:00

I have been writing Node.js apps for quite some time now, and I have

  • 0

I have been writing Node.js apps for quite some time now, and I have been seldom paying any attention to the use of forward slash vs backward slash when loading files using Node.js on Windows.

Now, after using both interchangeably without a problem, I’m starting to wonder, is there a significant difference between the two?

Up until now, the only difference that I have noticed is that JavaScript’s string literal (just like C and C++), requires that every backward slash be preceded by another backward slash. (In fact this is why I have been reluctant to use the backward slash, recently — even for Node.js on Windows –, because I fear forgetting that extra slash.)

  • 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-27T07:21:24+00:00Added an answer on May 27, 2026 at 7:21 am

    Just like what Raynos said in the comments, I should use the forward slash always, even on Windows.

    Update

    The above answer is really, really outdated. Always use path.join when constructing file paths from scratch.

    Example:

    // Get file.txt from a folder called `somefolder` that is
    // located in the same directory as the currently running
    // .js file.
    path.join(__dirname, 'somefolder', 'file.txt');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been writing C++ Console/CMD-line applications for about a year now and would
I have been writing DLL on C++, that will be use in C#. DLL
I have been writing web applications for quite sometime in PHP with MySQL. I
I have been writing articles on the wordpress.com blog , now I am looking
I have been experimenting with writing applications that use a local SQL Database to
I have been writing some Web services to be used by a few different
I have been writing some code that detects add and removal of USB devices,
I have been writing some code with basically this structure namespace util { void
I have been writing unit tests using NUnit and Moq with my Silverlight code
I have been writing Python code for only a couple of weeks, so I'm

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.