require关键字引用其他封装好的js模块 继而实现对js文件做了模块化管理

// 引入模块化的js文件   避免引包之间存在相同引用   产生引用覆盖和调用错误
var moduleA =require('./a.js')
var moduleB =require('./b.js')
var moduleC =require('./c.js')

moduleA.test();
moduleA.to_str('abc');
moduleB();
moduleC();
// module 作为模块方法的管理方式
// 管理多个方法的时候可以将引入对象变成对象数组保存方法别名
// 两种写法
// module.exports = {
// test:test,
// to_str:to_str
// }
exports.test = test;
exports.to_str=to_str;

function test(){
console.log('test.....01')
}

function to_str(str){
return str.toUpperCase()
}
function test(){
console.log('test.....02')
}
module.exports = test
function test(){
console.log('test.....03')
}
module.exports = test