How to Use Firefox Browser's Scratchpad

Test your JavaScript in real time

Scratchpad

Guiwp/Wikimedia Commons/CC BY-SA 3.0

Firefox contains a handy toolset for developers, including integrated Web and error consoles as well as a code inspector. Also part of the browser's Web development suite is Scratchpad, a tool that allows programmers to toy with their JavaScript and executes it from right within a Firefox window. Scratchpad's simple interface can prove to be quite convenient for JavaScript developers. This step-by-step tutorial teaches you how to access the tool as well as how to use it to create and refine your JS code.

This tutorial is only intended for users running the Firefox Web browser on Linux, Mac OS X, or Windows operating systems.

Using Scratchpad With JavaScript

  1. First, open your Firefox browser.

  2. Press the Firefox menu button, located in the upper right-hand corner of your browser window and represented by three horizontal lines.

  3. When the drop-down menu appears, select the Web Developer option. The menu will shift to display the developer sub-menu options.

    Firefox main menu
  4. Choose Scratchpad, found within this menu.

    Firefox web developer menu

    You can use the following keyboard shortcut in lieu of this menu item: SHIFT + F4.

  5. Scratchpad should now be displayed in a separate window. The main section contains some brief instructions, followed by a blank space reserved for your input.

    Firefox with scratchpad open
  6. Once you have entered some JavaScript code click on the Execute menu, which includes the following options:

  • Run: This option executes the selected code within the Scratchpad window. The keyboard shortcut for this menu item is CTRL + R on Windows and COMMAND + R on Mac OS X.
  • Inspect: This option executes the selected code, and also opens up an instance of the object inspector on the specific value returned. This allows you to drill down into a particular object. The keyboard shortcut for this menu item is CTRL + I on Windows and COMMAND + I on Mac OS X.
  • Display: This option executes the selected code, displaying the result directly in the editor window itself. The keyboard shortcut for this menu item is CTRL + L on Windows and COMMAND + L on Mac OS X.
Firefox scratchpad with code run