回调嵌套的两种写法,有什么区别?
bsnry 2017-12-14 11:57:16 写法一:
arp.getMAC('192.168.1.101', function(err, mac) {
console.log('mac address: '+mac);
arp.getMAC('192.168.1.114', function(err, mac) {
console.log('mac address: '+mac);
});
});
写法二:
arp.getMAC('192.168.1.101', function(err, mac) {
console.log('mac address: '+mac);
});
arp.getMAC('192.168.1.114', function(err, mac) {
console.log('mac address: '+mac);
});
写法一和写法二有什么区别?
哪一种更好?