我有这样一段代码:
tg.外部_routes.forEach(功能(条目){console.log(entry._commands[0]._textPattern)});
因为对象内部(entry._commands[0]._textPattern)有三个项,所以console.log将被调用三次。
如何将“entry._commands[0]._textPattern”存储到变量(可以是数组)中,然后在anonym函数之外使用该变量?
我需要一个不同的变量,因为我不想稍后将forEach的输出一次性传递给处理程序。