参考来源:https://blog.csdn.net/qq_33745501/article/details/80270708
与path.resolve有点相似
参数无个数限制,从左至右将参数拼接成一个路径,支持..向上跳转,若有错误则报错
例如以下
const path = require('path');
let myPath = path.join(__dirname,'/img/so');
let myPath2 = path.join(__dirname,'./img/so');
let myPath3=path.join('/foo', 'bar', 'baz/asdf', 'quux', '..');
console.log(__dirname);
console.log(myPath);
console.log(myPath2);
console.log(myPath3);
