Closed Bug 1026658 Opened 10 years ago Closed 10 years ago

$_ should access the most recently evaluated expression in the console

Categories

(DevTools :: Console, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 792063

People

(Reporter: bgrins, Unassigned, Mentored)

Details

This is a handy shortcut in the console that lets you access the most recently evaluated expression:

It's supported by both Firebug and Chrome:
Firebug: https://getfirebug.com/wiki/index.php/Command_Line_API#.24
Chrome: https://developer.chrome.com/devtools/docs/commandline-api#_

Example:

var foo = "bar"
foo             // Evaluates to "bar"
$_              // Evaluates to "bar"
Might as well implement the other $ shortcuts as well.
Besides $_, we are only missing $p, $n and $1. $n and especially $1 seem only marginally useful and $n isn't supported by Chrome (but they do have $2 - $4, *sigh*). Chrome doesn't even have $p, they use "window.tempXX" IIANM. 

I will be happy to mentor anyone who has the time to work on this, but I'm not sure if we want to add all of them without clear evidence that people want them.
Mentor: past
This would be useful, so I'd like to take a shot at it.
I came across this today whilst searching for $_ 

It seems linked to #792063 (which has a patch for adding $_).
It is indeed a duplicate, thanks!
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.