admin管理员组文章数量:1391929
I know I can edit values or properties on an object in the Chrome debugger, but is there a way to add properties?
Edit: Here's an example of what I mean. In this popup window I can edit that values of these properties on this object. Is there a way I can add new properties to this object?
I know I can edit values or properties on an object in the Chrome debugger, but is there a way to add properties?
Edit: Here's an example of what I mean. In this popup window I can edit that values of these properties on this object. Is there a way I can add new properties to this object?
Share Improve this question edited Aug 11, 2015 at 16:49 Anthony asked Aug 11, 2015 at 16:35 AnthonyAnthony 1,8472 gold badges18 silver badges30 bronze badges 4-
1
You mean like:
var obj = {};
[Enter]obj.prop = 1;
? – Mike Cluck Commented Aug 11, 2015 at 16:39 - Kind of. I mean when I'm debugging a javascript file and Chrome hits a break point. When you hover over an object a small window appears and you can change the values of the properties of that object in that window. Is there a way to add another property to that object? – Anthony Commented Aug 11, 2015 at 16:45
-
2
$scope.thing = "that";
[Enter] – Lee Taylor Commented Aug 11, 2015 at 16:51 - Wow, that worked! I'm surprised I didn't know that. I suppose that is the answer to my question. – Anthony Commented Aug 11, 2015 at 16:53
1 Answer
Reset to default 6For the example in your image, if you were stopped in debugging mode all you would have to do is enter something like $scope.newProp = 'value';
into the console. The object will now have a new property while you continue to debug your program.
本文标签: javascriptCan I add properties to an object in the Chrome debuggerStack Overflow
版权声明:本文标题:javascript - Can I add properties to an object in the Chrome debugger? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744685494a2619673.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论