您好,这是我在 Node js 文件中的方法:
exports.start = function() {
console.log(' in start of sender.js');
});
如何在同一个js文件中调用这个方法?我尝试调用 start() 和 exports.start() 但不成功。
最佳答案
使用此代码:
var start = exports.start = function() {
console.log(' in start of sender.js');
});
或
function start() {
console.log(' in start of sender.js');
});
exports.start = start;
//you can call start();
关于node.js - 在同一个js文件node.js中调用exports.start,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13859404/