And by the way, foo and bar would be string literals
I've seen a bunch of repositories that use both, "foo/bar" and "foo", "bar"
I did a benchmark with benchmark js with the following code (I also made a gist)
suite.add('foo/bar', function() {
path.join(__dirname, 'foo/bar')
})
.add('foo, bar', function() {
path.join(__dirname, 'foo', 'bar')
})
.on('complete', function() {
console.log('Fastest is ' + this.filter('fastest').map('name'));
})
.run({ 'async': true });
And foo/bar was faster. But I still see a lot of code like path.join(__dirname, '..', '..', 'node_modules')
So is there any reason to use path.join(__dirname, 'foo', 'bar')?
I'm also talking about path.resolve