admin管理员组文章数量:1314480
I'm using Chrome's (v21) dev tools to debug a large javascript application. While stepping through the code, I'd like to change the value of a local (function scope) variable. How do I do this?
I've tried:
- Clicking on the variable in the "Scope" window and editing it, hitting Enter afterward. The value changes in the Scope window as expected, but when I step to the next line, the variable then reverts back to its old value.
- Typing "variable = 123" in the console. After I hit Enter, the console "result" is the value I entered, but the variable itself does not change in value. If I then enter "variable" and hit Enter, the console returns the original value; the Scope window also shows the original value still.
Again, this is a local, function-scoped variable, and the current line of execution is within the same scope where the variable was defined.
This other question is essentially a duplicate, but hasn't elicited any useful answers (maybe because it's poorly written).
I'm using Chrome's (v21) dev tools to debug a large javascript application. While stepping through the code, I'd like to change the value of a local (function scope) variable. How do I do this?
I've tried:
- Clicking on the variable in the "Scope" window and editing it, hitting Enter afterward. The value changes in the Scope window as expected, but when I step to the next line, the variable then reverts back to its old value.
- Typing "variable = 123" in the console. After I hit Enter, the console "result" is the value I entered, but the variable itself does not change in value. If I then enter "variable" and hit Enter, the console returns the original value; the Scope window also shows the original value still.
Again, this is a local, function-scoped variable, and the current line of execution is within the same scope where the variable was defined.
This other question is essentially a duplicate, but hasn't elicited any useful answers (maybe because it's poorly written).
Share Improve this question edited May 23, 2017 at 11:59 CommunityBot 11 silver badge asked Sep 28, 2012 at 14:57 GreenGiantGreenGiant 5,2661 gold badge53 silver badges82 bronze badges 6-
+1 - I've not run into a situation where I've needed to do this, but it's true, I would have expected it to work like the
immediate window
in Visual Studio. Can verify that Chrome v22 is the same. Have you looked through the Chrome bug reports to see if there's something along these lines reported? I'm sure it isn't a 'bug' per se... more just 'non-intuitive behavior' – BLSully Commented Sep 28, 2012 at 15:02 - Using a different variation of keywords, I was able to find another question that answers this. Disappointing that you cannot do this in Chrome. :( – GreenGiant Commented Sep 28, 2012 at 15:04
- Alas, you cannot. I'm sure there's already an open issue about that... Since a very long time. – MaxArt Commented Sep 28, 2012 at 15:19
- I'm surprised that this is not possible in Chrome dev tools. I do this in Firebug all the time. – Kevin Boucher Commented Sep 28, 2012 at 22:01
- 1 Already implemented in V8: Issue 2399 Now Chromium's Developer Tools need to be updated: Issue 124206 – gabrielmaldi Commented Mar 21, 2013 at 17:48
2 Answers
Reset to default 2This feature is yet to be implemented. It is absolutely reasonable thing to do, hopefully it will be implemented soon in V8–protocol–devtools.
This apparently got fixed eventually. From the issue that @gabrielmaldi linked issue 124206:
Comment 29 by [email protected] on Wed, May 4, 2016, 3:19 PM EDT 51.0.2696.0 is the first [development] version that includes a build of v8 that incorporates a fix for this regression (v8 version 5.1.224 includes this fix, and 51.0.2696.0 targets v8 version 5.1.227.1).
本文标签: javascriptHow do you change the value of a local variable using Chrome39s dev toolsStack Overflow
版权声明:本文标题:javascript - How do you change the value of a local variable using Chrome's dev tools? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741968825a2407709.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论