【发布时间】:2020-02-06 02:51:29
【问题描述】:
我有 2 个文件。
//callee.js
const first = (name) => {
return name;
}
const second = (name) => {
return name + " is this";
}
module.exports = [
first,
second
]
//caller.js
const nav = require("./callee.js");
console.log(nav.first("bob")); //returns bob
...(Object.values(nav)); //want something like this
first("bob"); // this should return bob
如何在caller.js中调用或解构导入变量"nav"得到上述结果?
【问题讨论】:
标签: javascript node.js reactjs