【发布时间】:2014-10-14 17:01:16
【问题描述】:
我想连接两个数组。在下面的代码中,我只得到 txs_history 数组。
getFirstArray(function(txs) {
getSecondArray(function(txs_history) {
txs.concat(txs_history);
res.send(txs_history);
});
});
据我所知,我可以猜测 txs var 无法在 getSecondArray 中读取,这就是它只发送 txs_history 的原因。我不知道如何解决这个范围问题。
问候,
【问题讨论】:
-
如果
txs不在范围内,你会得到一个例外。
标签: javascript arrays concatenation scope