Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access last logged value in Chrome console

When I evaluate an expression directly in the Chrome Console like

1 + 1 

then I can reference to the evaluated value using

$_ 

enter image description here

However, I can't access the value with $_, when the value is a result of a console.log, coming from inside of my application, instead of an expression I typed directly into the console.

enter image description here

Is there a way to access the last evaluated expression, regardless where it came from?

like image 275
Robin Drexler Avatar asked Apr 09 '13 07:04

Robin Drexler


People also ask

How do I find the console log?

Steps to Open the Console Log in Google Chrome With the Chrome browser open, right-click anywhere in the browser window and select Inspect from the pop-up menu. By default, the Inspect will open the "Elements" tab in the Developer Tools. Click on the "Console" tab which is to the right of "Elements".

How do I export my Chrome console log?

Chrome console log Select the 'Console'' tab and make sure the option 'Preserve log' is checked. Reproduce the issue. You'll see data being collected in the console window. Right click on any log statement in the console window, and click Save As… to save the log file to your computer.

What is console log in browser?

The console. log() method outputs a message to the web console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects. Note: This feature is available in Web Workers.


1 Answers

After it's been logged to the console, you can right click on it and get an option to Store as global object. Clicking this will define a new variable like 'temp1' which will point to the variable. Here's a video of it in action (not mine).

like image 189
sdr Avatar answered Sep 23 '22 00:09

sdr