Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Var_dump For Javascript

DZone's Guide to

Var_dump For Javascript

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


function var_dump(obj) {
   if(typeof obj == "object") {
      return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + obj;
   } else {
      return "Type: "+typeof(obj)+"\nValue: "+obj;
   }
}//end function var_dump
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}