Print-out values to Google Chromes javascript console

For the purpose of debugging you may want to print values to Google Chromes javascript console (Ctrl+Shift+J).

Below is the format you would use:

<script>
   var valOne = 'One';
   console.dir ("The output of ValOne is: " + (valOne));
</script>

The above would print out this to the javascript console: 
The output of ValOne is: One ​​

Justin Chevallier

Justin Chevallier

Avid Drupal site builder & user for +9 years.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.