0
我發現async有兩個util函數:log
和dir
。async.log和async.dir有什麼區別?
但我沒有發現他們之間的許多差異。看到代碼:
var async = require('async');
var x = function() {
this.name = 'Freewind';
}
var hello = function(name, callback) {
setTimeout(function() {
callback(null, 'hello ' + name, 'nice to see you ' + name, x, {a:'123'});
}, 200);
};
async.log(hello, 'world');
async.dir(hello, 'world');
它打印:
hello world
nice to see you world
[Function]
{ a: '123' }
'hello world'
'nice to see you world'
[Function]
{ a: '123' }
你可以看到唯一的區別是後一個具有環繞效果更加'
。
是否有任何示例顯示dir
可以做但log
不能?
我沒有發現'console.log'和'console.dir'之間有什麼區別,我錯過了什麼嗎? – Freewind