Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

var_dump for javascript (See related posts)

hackish implementation of the php 'var_dump()' in javascript:

   1  
   2  function var_dump(obj) {
   3     if(typeof obj == "object") {
   4        return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + obj;
   5     } else {
   6        return "Type: "+typeof(obj)+"\nValue: "+obj;
   7     }
   8  }//end function var_dump

You need to create an account or log in to post comments to this site.


Click here to browse all 5827 code snippets

Related Posts