How to Use Scratchpad in Firefox

How to Use Scratchpad in Firefox
(Image © Scott Orgera).

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

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 execute 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.

First, open your Firefox browser. Click on the Firefox menu button, located in the upper right-hand corner of your browser window and represented by three horizontal lines. When the drop-down menu appears, select the Developer option. A sub-menu should now appear. Click on Scratchpad, found within this menu. Note that you can use the following keyboard shortcut in lieu of this menu item: SHIFT + F4

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. In the example above, I have entered some basic JavaScript code in the space provided. Once you have entered some JavaScript code click on the Execute menu, which contains 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.