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 linear winforms for couple of months and now I am
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 writing simple bash scripts for a while now, and I was
I have been writing housekeeping script , now i need to install housekeeping script
I have been writing a plug-in for Maya with C++. The Makefile I use
I have been writing this encryption algorithm in my free time for a few
I have been writing some code for a lib and experimented with a default

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.