我一直在学习node.js,我对此有些困惑:
这样:
home.lights.on('on', function(number, room) {
console.log('light number %d in room %s was turned on', number, room);
});
和此:
function lightsOn(number, room){
console.log('light number %d in room %s was turned on', number, room);
}
lightsOn(1,2);
做同样的事情还是他们之间有区别?