Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
45 views1 page

Pages From Oreilly - Javascript.patterns - Sep.2010

The document discusses using the Firebug console to log and print debugging information. It shows examples of using the console.log() and console.dir() methods to print variables and objects to the console for inspection. It notes that console.log() does not need to be explicitly called when typing directly in the console, and some code snippets omit it for brevity when the code is meant to be tested in the console.

Uploaded by

abhijeet_sangwan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views1 page

Pages From Oreilly - Javascript.patterns - Sep.2010

The document discusses using the Firebug console to log and print debugging information. It shows examples of using the console.log() and console.dir() methods to print variables and objects to the console for inspection. It notes that console.log() does not need to be explicitly called when typing directly in the console, and some code snippets omit it for brevity when the code is meant to be tested in the console.

Uploaded by

abhijeet_sangwan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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