报错:teacher.add is not a function
//student.js
function add(student){
console.log('Add Student' + student);
}
exports.add = add;
//teacher.js
function add(teacher){
console.log('Add Teacher' + teacher);
}
exports.add = add;
//klass.js
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;
//index.js
var klass = require('./klass');
klass.add('Scott', ['小明','小红']);
我实在找不出哪里错了, 一直报错teacher.add is not a function