Elektrine lite

← Feed

@blinry@chaos.social

Post #2981913

2026-02-15 16:18 UTC

There are more "Console Helpers" in #firefox: $_ is a shortcut to the result of the last expression you executed, allowing you to do some neat step-by-step exploration. And $0 refers to the currently-inspected element on the page.

Replies (4)

  • @blinry@chaos.social 2026-02-15 16:22

    There's a couple more, like copy(), which copies its argument to your clipboard, or keys(), an abbreviation for Object.keys(). If you ever forget these console helpers, you can run :help to open the page of the documentation that explains them! https://firefox-source-docs.mozilla.org/devtools-user/web_console/helpers/

    Open ##2981914

  • @blinry@chaos.social That's very Perl-like!

    Open ##2981934

  • @jetcool@mastodon.social 2026-02-15 17:28

    @blinry@chaos.social you can right-click an element and "Use in Console" will create a temporary variable with that element

    Open ##2981935

  • @ellnix@fosstodon.org 2026-02-15 20:05

    @blinry@chaos.social ruby's irb and python have the same feature with the _ variable! IRB: irb(main):001> 5 + 2 => 7 irb(main):002> _ => 7 Python also seems to avoid overriding _ when your statement returns None: >>> 5 + 2 7 >>> _ 7 >>> print("hello world") hello world >>> _ # still 7! 7 >>> None >>> _ # still 7! 7

    Open ##2981936