8 lines
296 B
JavaScript
8 lines
296 B
JavaScript
const path=require('path');
|
|
var testPath='f:code/node/chenxuan.js'
|
|
|
|
// __dirname 表示当前js文件所处的目录
|
|
// join 拼接路径
|
|
// '…/'会抵消掉一层路径
|
|
console.log(path.join(__dirname,'/hehe1','/hehehe2','/hehehe3'))
|
|
console.log(path.join(__dirname,'/hehe1','../','/hehehe3')) |