With the popularity of HTML5 and other heavily client-side driven web content, comes the need for a robust developer toolset to allow for easy debugging and testing of web pages. Fortunately, each of the modern browsers have adapted or integrated some very similar setups for doing just this. One of the most important features within this toolset is the JavaScript console. The JavaScript console is to web developers what the Flash Output window is to Flash developers. This is a critically important area to print data from initialized applications or websites and print statements or values specified within the code. In ActionScript, printing data to the output window is accomplished by using the trace()
function. In JavaScript, we utilize the console
object's built-in methods for doing the same. Consider the following example:
function calculateSum(a, b) { sum = a + b; console.log("The sum of " + a + " + " + b + " = " + sum); } calculateSum(2, 3);