美文网首页让前端飞
export和module.export的区别(秒懂)

export和module.export的区别(秒懂)

作者: 熊师傅 | 来源:发表于2017-11-13 13:14 被阅读0次
// hello.js
funciton hello () {
    console.log('hello');
}
1.
export.hello = hello;

var aaa = require('hello.js');
aaa.hello();    // console.log('hello');

2.
module.export = hello;

var aaa = require('hello.js');
aaa();      // console.log('hello');

相关文章

网友评论

    本文标题:export和module.export的区别(秒懂)

    本文链接:https://www.haomeiwen.com/subject/lfczmxtx.html