一,模块的基本分类
二,模块的流程
三,简单示例
1,模块student:
function add(student){ console.log('add student:'+student); } exports.add=add
2,模块teacher:
function add(teacher){
console.log('add teacher:'+teacher);
}
exports.add=add
3,模块class:
var student=require('./student')
var teacher=require('./teacher')
function add(teacherName,students){
teacher.add(teacherName)
students.forEach(function(item,index){
student.add(item)
})
}
exports.add=add
4,调用:
var klass=require('./klass') klass.add('lhc',['小白','sb'])