While passing address in nodejs, when to place '/' between directories and when to place '\' . And why do we place dot(.) before writing addresses
2
There are 2 answers
0
On
In a Unix/Linux environments you place a forward slash as a folder seperator.
e.g. /home/user/image.jpg
In a Windows system you use backslashes as folder seperators, since a backslash is also an escape character in a string you should escape the backslash.
e.g. C:\users\user\image.jpg
You use a . for relative paths. e.g. if your script runs in /home/user/ and you want to access image.jpg you can do so by ./image.jpg
for more info: https://nodejs.org/api/path.html
path package provides functionality so that you don't need to worry about what directory separator you need to use.
And dot represents current directory i.e.