nodejs之不同方式的exports和调用

来源:互联网 发布:尚硅谷javascript视频 编辑:程序博客网 时间:2024/06/03 03:33

filea.js

var testa = require('./fileb').testa;var testb = require('./fileb').testb();testa.aa();//test--aatestb.aa();//test--bb


fileb.js
var testa = (function(){    return{        aa:function(){            console.log("test--aa");        }    }})()var testb = function(){    return {        aa:function(){            console.log("test--bb");        }    }}exports.testa = testa;exports.testb = testb;


1 0
原创粉丝点击