我有以下代码test1.js.
module.exports = function(d){
d.demo1 = function() {
return "DEMO 1";
},
d.demo2 = function() {
return "DEMO 2";
}
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试访问函数demo1 test2.js.在调用函数的代码下面.
var demo = require('./test1');
var result = demo.****; //code to call function demo1
console.log("calling function", result); //output should be "calling function DEMO 1"
Run Code Online (Sandbox Code Playgroud)
请帮助我如何访问此功能.谢谢.