10

Is there an equivalent to the Python _ in JavaScript referencing the last value printed in the console?

I'm especially interested in Chrome.

1 Answer 1

12

In Chrome and Firefox, you can use $_. It references the return value from the last evaluation.

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

It doesn't seem to be working here: jsfiddle.net/YDkYV How can I print the last value that was printed?
I think this is the last expression evaluated in the console, and not just anything that was printed with console.log, unfortunately.
Just noting that this works in Mozilla Firefox too (tested on version 39).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.