【发布时间】:2016-11-07 23:45:15
【问题描述】:
我正在使用一个名为 horseman 的 npm 模块,它基本上是用于 Node 的 PhantomJS。当我控制台记录一个骑士对象的内容时,它包含有关当前页面的各种数据。所有这些数据中都包含一个页面所有资源的列表及其 http 状态代码,如下所示:
responses: [ 'http://tylertrotter.com/': 301,
'http://www.tylertrotter.com/': 200,
'http://www.tylertrotter.com/css/main.css': 200,
...
]
它看起来像一个数组/对象混合体,我以前从未遇到过这样的事情。 Array.isArray(responses) 产生 true 但 responses.length 出现 0。
这是什么东西?
整个 horseman 对象的完整控制台日志:https://gist.github.com/tylertrotter/be8da3e777c16a2b631d9de9fc94f70b
【问题讨论】:
-
这是 JavaScript 问题还是骑士问题?我想他们猴子修补了 .toString 方法
-
能否请您粘贴以下输出:
console.log(responses) -
@webdeb 我已经添加了整个对象。
responses从第 29 行开始。 -
@tylertrotter 在 horseman 找到了你的要旨和问题,很好理解
标签: javascript arrays node.js object