未捕获的类型错误:在遍历对象时非法调用

Uncaught TypeError: Illegal invocation when looping through object

本文关键字:对象 遍历 非法 调用 类型 错误      更新时间:2023-09-26

我正在尝试创建一个for循环,它循环一个对象,并且应该分别记录仪器的适当值,但我得到这个未知的错误时执行这个:

gge = true;
for (var ins in instruments) {
    if (gge) {
        this_ = ins;
        console.log(instruments[this_]);
    }
};

执行这个脚本会导致这个错误…

Uncaught TypeError: Illegal invocation

instruments对象是http://pastebin.com/tRzvpwgU

谁能帮我解决这个问题?或者解释为什么会发生这种情况?

I tried.

console.log(JSON.stringify(instruments[meow]));

字符串以某种方式删除错误。