as everyone knows Windows does paths with backslashes where Unix does paths with forward slashes. node.js provides path.join() to always use the correct slash. So for exampl
path.join
will take care of unneccessary delimiters, that may occur if the given pathes come from unknown sources (eg. user input, 3rd party APIs etc.).
So path.join('a/','b')
path.join('a/','/b')
, path.join('a','b')
and path.join('a','/b')
will all give a/b
.
Without using it, you usually would make expectations about the start and end of the pathes joined, knowing they only have no or one slash.