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.