[英]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.