简体   繁体   English

如何查看chrome中infor循环的javascript的每一步?

[英]how to see every step of javascript for in loop in chrome?

I found in chrome, can't see every step of the for in loop. 我在chrome中发现,看不到for in循环的每个步骤。 for example, using chrome's or chrome canary's debugger, set a break point in the line 例如,使用chrome或chrome canary的调试器,在行中设置一个断点

for (var i in stuff)

of the following code,when paused,and click step into untill the line 在暂停时,单击以下代码,直到进入该行

return n;

you can see the for in loop will finish one time.I want to see the entire process of for in loop. 您可以看到for in循环将完成一次。我想查看for in循环的整个过程。 so the question is: how to see every step of javascript for in loop in chrome? 所以问题是:如何在chrome中查看infor循环中javascript的每个步骤?

function objectPlus(o, stuff) {
    var n;
    function F() {}
    F.prototype = o;
    n = new F();
    n.uber = o;

    for (var i in stuff) {
        // I found in debuger, for in loop will finish in one step into,so you can't see the process of every property copy
        n[i] = stuff[i];
    }

    return n;
}

var shape = {
    name: 'shape',
    toString: function() {
        return this.name;
    }
};

var twoDee = objectPlus(shape, {
    name: '2D shape',
    toString: function() {
        return this.uber.toString() + ', ' + this.name;
    }
});

Click on Sources and JS will be displayed. 单击Sources,将显示JS。

Click on the target js file 单击目标js文件

On the left hand side - Line numbers will appear 在左侧-行号将出现

Click on the line number on which you want breakpoint / pause 单击要断点/暂停的行号

Function Key --> F11 - and if you want to see the output put a console.log inside your for loop --> console.log(n[i]) 功能键-> F11-如果要查看输出,请将console.log放入for循环内-> console.log(n [i])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google chrome 没有详细显示 for 循环。 我想看到每一步 - Google chrome doesn't show the for loop in detail. I want to see every step 如何一步步看网站上的JavaScript执行过程? - How to see the JavaScript execution process on the site step by step? javascript-如何通过在 Chrome 中调试在一个 if 语句中查看每个条件的结果? - javascript-how can I see result of every condition in one if statement By Debugging in Chrome? 如何在Chrome中调试/逐步浏览动态JavaScript? - How to debug / step through dynamic JavaScript in Chrome? Javascript-使用循环查看Chrome中的旧Facebook消息,不知道如何使其停止 - Javascript - Used a loop to see old facebook messages in Chrome, don't know how to make it stop chrome JavaScript调试器:如何输入值并查看? - chrome javascript debugger: how to enter value and see it? 如何在 JavaScript 中只定义一次变量,而不是在后台脚本的每个循环中。 镀铬扩展 - How to define variable only once in JavaScript not on every loop in background script. chrome extensions 如何在Google Chrome javascript调试器中单步执行代码 - How to step through code in Google chrome javascript debugger javascript for循环如何计算每四个项目? - javascript for loop how to count every four items? 我如何查看当前使用chrome inspector运行的javascript? - How do i see the current javascript running with chrome inspector?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM