Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Figure 1-1.

Using the Firebug console


We often use the method log(), which prints all the parameters passed to it, and some-
times dir(), which enumerates the object passed to it and prints all properties. Here’s
an example usage:
console.log("test", 1, {}, [1,2,3]);
console.dir({one: 1, two: {three: 3}});

When you type in the console, you don’t have to use console.log(); you can simply
omit it. To avoid clutter, some code snippets skip it, too, and assume you’re testing the
code in the console:
window.name === window['name']; // true

This is as if we used the following:


console.log(window.name === window['name']);

and it printed true in the console.

The Console | 7

You might also like