Appendix A. Up and Running in jsBin and jsFiddle
script elements. The snippets can be copied directly into jsBin or jsFiddle or, for the most part, run using Node. In this Appendix, I’ll briefly cover the information you’ll need to run the examples successfully.
The Console Is Your Friend
Formally, we should use unit testing for determing application state, but I’ve not found it to be as friendly or helpful as a good old print out of data. In the past, we used
alert() to print out values, but now we have the console.
All the main browsers (i.e., Internet Explorer, Firefox, Chrome, Opera, and Safari) have access to a console, as does Node. Here’s a quick cheatsheet:
- To access the console in Opera, click Tools in the menu, then open up Opera Dragonfly and select the Console.
- In Safari, enable the Develop menu in Safari’s Advanced preferences to access the Console.
- The Internet Explorer console can be accessed by pressing F12, or selecting “F12 Developer Tools” from the Settings menu.
- In Firefox, access the console by selecting Developer from the Firefox settings menu, and then choosing “Browser Console”.
- In Node, output to the console prints to the standard output.
console.log() all throughout the book, but there are other methods you can use. Among my other favorites are the following: