29 ms·
I wish I could get a reference from the console command line to an object I printed in the console earlier. For example: in my code I write console.log({ foo:
by throwaway41597 13y ago
I wish I could get a reference from the console command line to an object I printed in the console earlier.
For example: in my code I write console.log({ foo: function(msg) {...} }). The object is displayed as "[object Object]" (which isn't as good as Chrome's output by the way) and, sure, I can click it to inspect it,but what I'd like is, like, right-click->"Copy reference" and then it puts "$_(123)" in my clipboard, where $_ is a console-defined function which takes a number and returns the matching output of the console history.
Then I can use the referenced object in a new command: e.g. $_(123).foo('hello').
Firebug has $_ [1] but it's just for the last output of the command line (not the console history). (edit: likewise for Chrome [2])
Thank you for the many enhancements.
[1]: https://getfirebug.com/wiki/index.php/Command_Line_API#.24 https://getfirebug.com/wiki/index.php/Command_Line_API#.24
[2]: https://developers.google.com/chrome-developer-tools/docs/commandline-api#_ https://developers.google.com/chrome-developer-tools/docs/co...