In chrome developer tool, we can save object values to a variable using "store as global variable". But I have been given an error as follows. "Failed to save to temp variable."
To add a variable to the watch list use the add icon to the right of the section heading. This will open an inline input where you provide the variable name to watch. Once it is filled in press your Enter key to add it to the list. The watcher will show you the current value of the variable as it is added.
I was having the same issue, went to the 'About Google Chrome'->Help and it said I needed to restart my browser to get the latest updates. I did this, and suddenly, I can now change local variables. Simply click the variable you want to edit in the Scope Variables window, and type in your new value.
The Chrome Web Inspector and Debugger are conveniently built-in with Chrome. You can launch it by hitting F12 while in your browser or by right clicking on a web page and selecting the Inspect menu item. The images below show a few different views that you'll see in the Chrome DevTools browser.
You need to double click the variable name, then right click will reveal the add to watch option.
Browser dev tools are so full of features it’s hard to keep up. I bet every developer knows a different set of features to each other. I wanted to share a few little tips that I use, that you might not know and that if I don’t write down I might forget.
Developer tools in any browser are for testing only, it is not possible to save changes from this tool. You can only make changes and save the changes in your code only. Our automated system analyzes replies to choose the one that's most likely to answer the question. If it seems to be helpful, we may eventually mark it as a Recommended Answer.
In order for Chrome to give you a reference to the object the object still has to be in memory. If that isn't the case it can only throw an error. However, I'm pretty sure that being shown in the console forces V8 to keep a reference to the value.
In this example, the debugger initially paused at the breakpoint (line 343) near the end of the toggleColorScheme function. To restart the debugging from the beginning of the toggleColorScheme function, expand the Call stack section in the Debugger pane, right click on toggleColorScheme and select Restart frame.
Is your object console.log
'd from an iframe
? That would make sense since the iframe
has its own scope.
Try creating the same object in the root html scope (not in an iframe
) and try the "store as a global variable" button.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With