为什么变量路径在undefined
循环中显示为.each
?
function tt(xml, path) {
var tree = new Array();
console.log('path=' + path); // This output as 'path = abc' -- ok
$(xml).contents().each(function() {
console.log('path=' + path); //this output as 'path=undefined' ??
//do something with xml
});
}
tt(x, 'abc');