英文:
different path syntax in node.js
问题
1st case:
let arr = require("../country/state/city/index");
let getFiNa = require("../utilities/utils/index");
let getPeopleInCity = (arr) => {
return getFiNa(arr);
};
console.log(getPeopleInCity(arr));
module.exports = getPeopleInCity;
2nd case:
const ob = require("./exportObject");
我明白你的困惑,"./" 和 "../" 在终端中有特定的含义,但在 JavaScript 模块中也有它们自己的用法。希望这有助于你理解。
英文:
question , some time we use ./ and some time ../
what is the difference
1st case
let arr = require("../country/state/city/index");
let getFiNa = require("../utilities/utils/index");
let getPeopleInCity = (arr) => {
return getFiNa(arr);
};
console.log(getPeopleInCity(arr));
module.exports = getPeopleInCity;
2nd case
const ob = require("./exportObject");
i am confused between these two syntax ./ amd ../ although i know the meaning in terminal but in JS module cases i am confused , help me to understand
答案1
得分: 3
.
表示在该文件夹中选择文件
../
表示退出当前文件夹并从上一个或父文件夹中选择
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论