Javascript var_dump function implementation code _ javascript skills

Source: Internet
Author: User
A very good JavaScript debugging method has been found. Currently, four types of ObjectArrayFunctionString can be printed. The usage method is the same as var_dump () in PHP, as long as you directly dump (variable name. A very good JavaScript debugging method has been found. Currently, four types of Object/Array/Function/String can be printed. The usage is the same as that of var_dump () in PHP, you only need to directly dump (variable name.

The Code is as follows:


Dump (value, [showTypes])
@ Param value (Any) value to dump
@ Param [showTypes] (Boolean) optional to display each key/value's type
@ Return (Void) returns nothing



The Dump method is based on one of the tags available in Coldfusion ( ) Providing the ability to display simple and complex variables in a user friendly way that is perfect for debugging/inspecting data. there is no way to do this with javascript and often I had wanted a method to do this. this method will do just that allowing for an infinite amount of data nesting complete with color coding for different data types, the ability to show/hide the data's type (String/Number/Boolean/Object/Array/Function), expandable and collapsible tables/keys and cross browser support.

Click on the buttons bellow to see some examples in action, toggle the Show Data Types box to see javascript data typing in action (not possible in Coldfusion ).

Browser Support
Internet Explorer 6, Internet Explorer 7, Firefox 1.5, Opera 8, Safari 1.2 (Mac), Firefox (Mac)-all tested, shoshould also work in most other browsers

Dump Examples
Official Website
Http://www.netgrow.com.au/files/javascript_dump.cfm
Related Files
Http://www.netgrow.com.au/assets/files/dump/dump.zip

In case the above address cannot be downloaded, the local
Http://www.jb51.net/jiaoben/20804.html
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.