访问的方法,可以在module.export外侧相同的节目
问题:我想从我们同PROGRAME的一侧访问module.export可用的方法
在下面progrme,我有一个方法可以inisde module.export从我们在同一个文件中端试图访问
//Module.export section
module.export = {
a: function (){ // Function a
console.log('My name is abc');
}
}
function b(){ //Trying to access the method out side of module.export
// How to access the function a from this metod
}
回答如下:
如果我理解正确的,它是如此简单(只有它应该是module.exports
,不module.export
):
module.exports = {
a: function (){
console.log('My name is abc');
}
}
function b(){
module.exports.a();
}