module1.jsModule.exports中的NodeJS,输出功能
module.exports = function (input, input2) {
return "exported";
};
modulegetter.js
var module1 = require('/Users/Aakarsh/Desktop/Node/ToDo/playground/module1.js');
console.log(module1);
这是什么输出:[function]
我希望它如在t中输出"exported"
他module1.js
类。我能做什么?
附加:
当我有这个,在modulegetter.js
,
var f = function (input, input2) {
return "exp";
};
console.log(f("f", "f"));
它输出exp
的要求,但为什么犯规它module.exports工作?
是什么module1'和'模块1()''之间的差值Δθ – Marodian
'module1()'执行/调用函数,'module1'只是对函数的引用,并返回函数本身,而不是它的结果/返回。 –
谢谢!等待接受答案 – Marodian